def do_sarf(word,future_type,all=True,past=False,future=False,passive=False,imperative=False,future_moode=False,confirmed=False,transitive=False,display_format="HTML"): import libqutrub.mosaref_main as mosaref import libqutrub.ar_verb as ar_verb import libqutrub.classverb as verbclass import libqutrub.verb_const as verb_const import pyarabic.arabrepr as myrepr from libqutrub.verb_valid import is_valid_infinitive_verb valid = is_valid_infinitive_verb(word) listetenses=[]; if valid: future_type= ar_verb.get_future_type_by_name(future_type); bab_sarf=0; vb = verbclass.VerbClass(word,transitive,future_type); #vb.verb_class(); vb.set_display(display_format); #test the uniformate function if all : if transitive : ## print "transitive"; listetenses= verb_const.TABLE_TENSE result= vb.conjugate_all_tenses(); else: ## print "intransitive"; listetenses = verb_const.TableIndicativeTense; ## print len(TableIndicativeTense) result= vb.conjugate_all_tenses(listetenses); else : listetenses=[]; if past : listetenses.append(verb_const.TensePast); if (past and passive and transitive) : listetenses.append(verb_const.TensePassivePast) if future : listetenses.append(verb_const.TenseFuture); if (future and passive and transitive) : listetenses.append(verb_const.TensePassiveFuture) if (future_moode) : listetenses.append(verb_const.TenseSubjunctiveFuture) listetenses.append(verb_const.TenseJussiveFuture) if (confirmed) : if (future):listetenses.append(verb_const.TenseConfirmedFuture); if (imperative):listetenses.append(verb_const.TenseConfirmedImperative); if (future and passive and transitive and confirmed) : listetenses.append(verb_const.TensePassiveConfirmedFuture); if (passive and transitive and future_moode) : listetenses.append(verb_const.TensePassiveSubjunctiveFuture) listetenses.append(verb_const.TensePassiveJussiveFuture) if imperative : listetenses.append(verb_const.TenseImperative) result =vb.conjugate_all_tenses(listetenses); #self.result["HTML"]=vb.conj_display.display("HTML",listetenses) #return result; return vb.conj_display.display("TABLE",listetenses) else: else: return None;
def get_future_form(verb_vocalised, haraka=araby.FATHA): """ Get The future form of a verb. for example the future form of qal with Damma as a Haraka of future verb, we get yqolu. الحصول على صيغة الفعل في المضارع، فالفعل قال، وحركة عينه في المضارع صمة، نحصل على يقول. @param verb_vocalised: given verb. @type verb_vocalised:unicode. @param haraka: the future mark for triverbs. @type haraka: unicode. @return: The conjugated form in the future tense. @rtype: unicode. """ word = verb_vocalised transitive = True future_type = haraka if future_type not in (araby.FATHA, araby.DAMMA, araby.KASRA): future_type = ar_verb.get_future_type_by_name(future_type) vbc = classverb.VerbClass(word, transitive, future_type) #vb.verb_class() return vbc.conjugate_tense_pronoun(vconst.TenseFuture, vconst.PronounHuwa)
def do_sarf(word, future_type, alltense=True, past=False, future=False, passive=False, imperative=False, future_moode=False, confirmed=False, transitive=False, display_format="HTML"): """ The main function to conjugate verbs. You must specify all parameters. Can be used as an example to call the conjugation class. @param word: the givern verb. the given word must be vocalized, if it's 3 letters length only, else, the verb can be unvocalized, but the Shadda must be given, it' considered as letter. @type word: unicode. @param future_type: For Triliteral verbs, you must give the mark of Ain in the future, كة عين الفعل في المضارع. it's given as a name of haraka (فتحة، ضمة، كسرة). @type future_type: unicode(فتحة، ضمة، كسرة). @param all: conjugate in all arabic tenses. @type all: Boolean, default(True) @param past: conjugate in past tense ألماضي @type past: Boolean, default(False) @param future: conjugate in arabic present and future tenses المضارع @type future: Boolean, default(False) @param passive: conjugate in passive voice المبني للمجهول @type passive: Boolean, default(False) @param imperative: conjugate in imperative tense الأمر @type imperative: Boolean, default(False) @param future_moode: conjugate in future moode tenses المضارع المنصوب والمجزوم @type future_moode: Boolean, default(False) @param confirmed: conjugate in confirmed cases tense المؤكّد @type confirmed: Boolean, default(False) @param transitive: the verb transitivity التعدي واللزوم @type transitive: Boolean, default(False) @param display_format: Choose the display format: - 'Text': - 'HTML': - 'HTMLColoredDiacritics': - 'DICT': - 'CSV': - 'GUI': - 'TABLE': - 'XML': - 'TeX': - 'ROWS': @type display_format: string, default("HTML") @return: The conjugation result @rtype: According to display_format. """ valid = verb_valid.is_valid_infinitive_verb(word) if valid: future_type = ar_verb.get_future_type_by_name(future_type) #~ bab_sarf = 0 #init the verb class to treat the verb vbc = classverb.VerbClass(word, transitive, future_type) vbc.set_display(display_format) if alltense: result = vbc.conjugate_all_tenses() else: listetenses = [] if past: listetenses.append(vconst.TensePast) if (past and passive): listetenses.append(vconst.TensePassivePast) if future: listetenses.append(vconst.TenseFuture) if (future and passive): listetenses.append(vconst.TensePassiveFuture) if (future_moode): listetenses.append(vconst.TenseSubjunctiveFuture) listetenses.append(vconst.TenseJussiveFuture) if (confirmed): if (future): listetenses.append(vconst.TenseConfirmedFuture) if (imperative): listetenses.append(vconst.TenseConfirmedImperative) if (future and transitive and confirmed): listetenses.append(vconst.TensePassiveConfirmedFuture) if (passive and future_moode): listetenses.append(vconst.TensePassiveSubjunctiveFuture) listetenses.append(vconst.TensePassiveJussiveFuture) if imperative: listetenses.append(vconst.TenseImperative) result = vbc.conjugate_all_tenses(listetenses) return result else: return None