Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#! /usr/bin/python
import sys
sys.path.append('lib');
import re
import string
import datetime
import getopt
import os
import pyarabic.araby as araby
import qalsadi.analex
scriptname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
scriptversion = '0.1'
AuthorName="Taha Zerrouki"
#Token_pattern=re.compile(u"([\w%s ]+)"%(u"".join(araby.TASHKEEL),),re.UNICODE);
Clause_pattern=re.compile(u"([\w%s\s]+)"%(u"".join(araby.TASHKEEL),),re.UNICODE);
#Token_pattern=re.compile(u"([^\w]+)",re.UNICODE);
# Token_pattern=re.compile(u"([^\w%s\s])+"%(u"".join(araby.TASHKEEL),),re.UNICODE);
def phraseSplit(text):
"""
Split Text into clauses
@param text: input text;
@type text: unicode;
@return: list of clauses
@rtype: list of unicode
"""
if text:
list_phrase = Clause_pattern.split(text);
if list_phrase:
j =- 1;
@type listtense: list of unicode
@return: the result as text in row.
@rtype: unicode.
"""
text = u""
transitive = "0"
if self.transitive:
transitive = '1'
for pronoun in vconst.PronounsTable:
## text += u"%s" % (pronoun)
for tense in listtense:
# print (self.verb).encode("utf-8"),
if self.tab_conjug[tense][pronoun] != "":
text += "\t".join([
araby.strip_harakat(self.tab_conjug[tense][pronoun]),
self.tab_conjug[tense][pronoun],
TAB_DISPLAY[pronoun],
TAB_DISPLAY[tense],
transitive,
self.verb,
self.bab,
])
text += u"\n"
return text