コード例 #1
0
"""
 ScharfSandhiArg.py  May 25, 2015
 Jul 26, 2015. 
 Jul 27, 2015
 9 May 2020 PMS added parenthesis for python 3 compatibility
"""
from scharfsandhi import ScharfSandhi

if __name__ == '__main__':
 import sys
 sopt = sys.argv[1]
 s = sys.argv[2]
 sandhi = ScharfSandhi()
 sandhi.history=[] # init history.  It is modified by wrapper
 sandhi.dbg=True
 err = sandhi.simple_sandhioptions(sopt)
 if err != 0:
  print("ERROR: sopt must be E, E1, or C, not",sopt)
  exit(1)
 ans = sandhi.sandhi(s)
 for h in sandhi.history:
  print(h)
 print('ScharfSandhiArg: ans="%s"' % ans)
コード例 #2
0
"""
 ScharfSandhiArg.py  May 25, 2015
 Python equivalent of ScharfSandhiArg.java
 
"""
from scharfsandhi import ScharfSandhi
ScharfSandhi.dbg = True  # July 24, 2015
if __name__ == '__main__':
    import sys
    sopt = sys.argv[1]
    s = sys.argv[2]
    if sopt == "E":
        err = ScharfSandhi.sandhioptions("E", "N", "S", "Y")
        soptPrint = "E,N,S,Y"
    elif sopt == "E1":
        err = ScharfSandhi.sandhioptions("E", "N", "S", "")
        soptPrint = "E,N,S,"
    elif sopt == "C":
        err = ScharfSandhi.sandhioptions("C", "N", "S", "")
        soptPrint = "C,N,S,"
    else:
        print "ERROR: sopt must be E, E1, or C, not", sopt
        exit(1)
    ans = ScharfSandhi.sandhi(s)
    print(ans)