51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/sanscript/detect.rb', line 51
def detect_script(text)
if text =~ RE_BRAHMIC_RANGE
RE_BRAHMIC_SCRIPTS.each do |script, regex|
return script if text =~ regex
end
end
if text =~ RE_IAST_OR_KOLKATA_ONLY
text =~ RE_KOLKATA_ONLY ? :kolkata : :iast
elsif text =~ RE_ITRANS_ONLY
:itrans
elsif text =~ RE_SLP1_ONLY
:slp1
elsif text =~ RE_VELTHUIS_ONLY
:velthuis
elsif text =~ RE_ITRANS_OR_VELTHUIS_ONLY
:itrans
elsif text =~ RE_HARVARD_KYOTO
:hk
else
:unknown
end
end
|