o =b#@sddlmZddlmZGdddeZGdddeZGdddeZGd d d eZGd d d eZ Gd ddeZ GdddeZ GdddeZ GdddeZ GdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZGd'd(d(eZGd)d*d*eZGd+d,d,eZGd-d.d.eZGd/d0d0eZGd1d2d2eZGd3d4d4eZGd5d6d6eZGd7d8d8eZGd9d:d:eZ Gd;d<dd>eZ"Gd?d@d@eZ#GdAdBdBeZ$GdCdDdDeZ%GdEdFdFeZ&GdGdHdHeZ'GdIdJdJeZ(GdKdLdLeZ)GdMdNdNeZ*GdOdPdPeZ+GdQdRdReZ,GdSdTdTeZ-GdUdVdVeZ.GdWdXdXeZ/GdYdZdZeZ0Gd[d\d\eZ1Gd]d^d^eZ2Gd_d`d`eZ3GdadbdbeZ4GdcddddeZ5GdedfdfeZ6GdgdhdheZ7GdidjdjeZ8GdkdldleZ9GdmdndneZ:GdodpdpeZ;dqS)r) BaseStemmer)Amongc @seZdZdZedddedddedddedddedddeddded dded dded dded ddg Zed ddedddgZedddedddedddedddgZedddedddedddedddgZedddedddgZ edddedddgZ edddedddedddedddgZ eddded ddgZ ed!dded"dded#dded$ddgZ ed%dded&ddgZed'dded(ddgZed)dded*ddgZed+dded,dded-dded.ddgZed/dded0dded1dded2ddgZed3dded4dded5dded6ddgZed7dded8dded9dded:ddgZed;ddeddded?dded@ddedAddedBddedCddedDddgZedEddedFddgZgedGddedHddedIddedJddedKddedLddedMddedNddedOddedPddedQddedRddedSddedTddedUddedVddedWddedXddedYddedZdded[dded\dded]dded^dded_dded`ddedaddedbddedcddeddddededdedfddZedgddedhddediddedjddedkddedlddedmddednddgZedoddedpddedqddedrddgZedsddteduddvedwddxedyddzgZgd{Zgd|Zgd}Zgd~Z gdZ!dgZ"dgZ#dgZ$dZ%ddZ&ddZ'ddZ(ddZ)ddZ*ddZ+ddZ,ddZ-ddZ.ddZ/ddZ0ddZ1ddZ2ddZ3ddZ4ddZ5ddZ6ddZ7ddZ8ddZ9ddZ:ddZ;ddZddZ?ddZ@ddZAddZBddZCddZDdd„ZEddĄZFddƄZGddȄZHddʄZIdd̄ZJdd΄ZKddЄZLdd҄ZMddԄZNdS)TurkishStemmerz This class implements the stemming algorithm defined by a snowball script. Generated by Snowball 2.2.0 - https://snowballstem.org/ mnmiznizmuznuzumüzunüzumızunızleriularıninuunüunıinunuünuınaenanedatadetendandedantandentenndanndenlalecaceimumuümuımsinsunusünusınizuzuüzuızsinizsunuzusünüzusınızlarlerdirtirdurturudürutürudırutırucasınacesineditidiktikduktukudükutükudıkutıkdimtimdumtumudümutümudımutımdintinduntunudünutünudınutındutuudüutüudıutısasesakseksamsemsansenumişumuşumüşumışbrcduğ)ArUrUrUrUrUrUrUrUrUrUrUrUrUrU rUrUrUrUrUrUr)rrTrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrWrUrUrUrUrUrUr)r@rTrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUr)rRrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrU)rrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrUrrRrSFcCs|j|j}|tjddsdSz*|j|j}z|ds!t|tjdds,ttty7Ynw|j||_z|dsGt |tj ddsRt tt y]Ynw|j||_z|dsmt |tj ddsxt tt yYnw|j||_z|d st |tjdd st tt yYnw|j||_z|d st|tjd d stttyYnw|j||_z|dst|tjddstttyYnw|j||_z|dst|tjd d stttyYnw|j||_|ds.WdS|tjdds:WdSWn tyEYnw|j||_dS)Na1FrreıiioouöuüT)limitcursorgo_out_grouping_brg_voweleq_s_blab1g_vowel1lab0lab2g_vowel2lab3g_vowel3lab4g_vowel4lab5g_vowel5lab6g_vowel6lab7selfv_1v_2rA/usr/lib/python3/dist-packages/snowballstemmer/turkish_stemmer.py__r_check_vowel_harmonys                  z&TurkishStemmer.__r_check_vowel_harmonycC6z|j|j}z"|dst|j|j}|tjdds!t|j||_tty2Ynw|j||_|j|j}z|j|j}|dsNt|j||_WWdSty`Ynw|j||_|j|j}|j|j krvWdS|jd8_|tjddsWdS|j||_WdStyYdSw)NrrZr[FrT rhrirlrm in_grouping_brrkrorplimit_backwardr|r}r~v_3v_4v_5rrr)__r_mark_suffix_with_optional_n_consonant%@            z8TurkishStemmer.__r_mark_suffix_with_optional_n_consonantcCr)NsrZr[FrTrrrrr)__r_mark_suffix_with_optional_s_consonantErz8TurkishStemmer.__r_mark_suffix_with_optional_s_consonantcCr)NyrZr[FrTrrrrr)__r_mark_suffix_with_optional_y_consonanterz8TurkishStemmer.__r_mark_suffix_with_optional_y_consonantcCsBz|j|j}z%|tjddst|j|j}|tjdds$t|j||_tty5Ynw|j||_|j|j}z|j|j}|tjddsTt |j||_WWdSt yfYnw|j||_|j|j}|j|j kr|WdS|jd8_|tjddsWdS|j||_WdStyYdSw)Nr`r[rZFrT) rhrirrg_Urmout_grouping_brkrorprrrrr%__r_mark_suffix_with_optional_U_vowels@          z4TurkishStemmer.__r_mark_suffix_with_optional_U_vowelcC$|tjdkr dS|sdSdSNrUFT) find_among_bra_04_TurkishStemmer__r_mark_suffix_with_optional_U_vowelr|rrr__r_mark_possessives z#TurkishStemmer.__r_mark_possessivescC0|sdS|tjddsdS|sdSdSNFr`r[T)&_TurkishStemmer__r_check_vowel_harmonyrrr8_TurkishStemmer__r_mark_suffix_with_optional_s_consonantrrrr __r_mark_sUzTurkishStemmer.__r_mark_sUcC|tjdkr dSdSr)rra_1rrrr __r_mark_lArIzTurkishStemmer.__r_mark_lArIcCrr)rrrr8_TurkishStemmer__r_mark_suffix_with_optional_y_consonantrrrr __r_mark_yUrzTurkishStemmer.__r_mark_yUcC$|sdS|tjdkrdSdSNFrUT)rrra_2rrrr __r_mark_nU zTurkishStemmer.__r_mark_nUcC0|sdS|tjdkrdS|sdSdSr)rrra_38_TurkishStemmer__r_mark_suffix_with_optional_n_consonantrrrr __r_mark_nUnrzTurkishStemmer.__r_mark_nUncCrr)rrra_4rrrrr __r_mark_yArzTurkishStemmer.__r_mark_yAcCrr)rrra_5rrrr __r_mark_nArzTurkishStemmer.__r_mark_nAcCrr)rrra_6rrrr __r_mark_DArzTurkishStemmer.__r_mark_DAcCrr)rrra_7rrrr __r_mark_ndArzTurkishStemmer.__r_mark_ndAcCrr)rrra_8rrrr __r_mark_DAnrzTurkishStemmer.__r_mark_DAncCrr)rrra_9rrrr __r_mark_ndAnrzTurkishStemmer.__r_mark_ndAncCrr)rrra_10rrrrr __r_mark_ylArzTurkishStemmer.__r_mark_ylAcCs|dsdSdS)NkiFT)rlrrrr __r_mark_kis zTurkishStemmer.__r_mark_kicCrr)rrra_11rrrrr __r_mark_ncA rzTurkishStemmer.__r_mark_ncAcCrr)rrra_12rrrrr __r_mark_yUmrzTurkishStemmer.__r_mark_yUmcCrr)rrra_13rrrr __r_mark_sUnrzTurkishStemmer.__r_mark_sUncCrr)rrra_14rrrrr __r_mark_yUz&rzTurkishStemmer.__r_mark_yUzcCrr)rra_15rrrr__r_mark_sUnUz/rzTurkishStemmer.__r_mark_sUnUzcCrr)rrra_16rrrr __r_mark_lAr4rzTurkishStemmer.__r_mark_lArcCrr)rrra_17rrrr __r_mark_nUz;rzTurkishStemmer.__r_mark_nUzcCrr)rrra_18rrrr __r_mark_DUrBrzTurkishStemmer.__r_mark_DUrcCrr)rra_19rrrr__r_mark_cAsInAIrzTurkishStemmer.__r_mark_cAsInAcCrr)rrra_20rrrrr __r_mark_yDUNrzTurkishStemmer.__r_mark_yDUcCrr)rra_21rrrrr __r_mark_ysAWrzTurkishStemmer.__r_mark_ysAcCrr)rrra_22rrrrr__r_mark_ymUs_^rzTurkishStemmer.__r_mark_ymUs_cCs|dsdS|s dSdS)NkenFT)rlrrrrr __r_mark_ykengs zTurkishStemmer.__r_mark_ykenc Cs|j|_d|_z|j|j}zkz_|j|j}z |sttty*Ynw|j||_z |s9tttyDYnw|j||_z | sSt tt y^Ynw|j||_| slt Wt tyzYt wt yYnw|j||_z|stz|j|j}z |stttyYnw|j||_z |stttyYnw|j||_z |stttyYnw|j||_z |stttyYnw|j||_z |s tttyYnw|j||_Wn ty(Ynw|s1tt ty=Ynw|j||_z|sMt|j|_|sZWWdS|j|j}z{|j|_zj|j|j}z |sutt tyYnw|j||_z |st!t t!yYnw|j||_z | st"t t"yYnw|j||_|s|j||_t#Wn t yYnwWn t#yYnwd|_t tyYnw|j||_zC|$st%z.|j|j}z |st&t't&y!Ynw|j||_| s0t%Wt t'y?Yt wt%yIYnw|j||_zzd|j|j}z |sat(t)t(ymYnw|j||_z |s}t*t)t*yYnw|j||_z |st+t)t+yYnw|j||_|st,Wn t)yYnw|j|_|sWWdS|j|j}z|j|_|s|j||_t-Wt t-yYt wt,yYnw|j||_|sWdS|j|_|sWdS|j|j} z|j|_z|j|j} z |s5t.t/t.yAYnw|j| |_z |sQt0t/t0y]Ynw|j| |_z |smt1t/t1yyYnw|j| |_z |st2t/t2yYnw|j| |_z |st3t/t3yYnw|j| |_Wn t/yYnw|s|j| |_t4Wn t4yYnwWn t yYnw|j|_|sdSdS)NTF)5riket!B_continue_stemming_noun_suffixesrh_TurkishStemmer__r_mark_ymUs_rrrp_TurkishStemmer__r_mark_yDUrt_TurkishStemmer__r_mark_ysArv_TurkishStemmer__r_mark_ykenrmro_TurkishStemmer__r_mark_cAsInArx_TurkishStemmer__r_mark_sUnUzlab8rz_TurkishStemmer__r_mark_lArlab9_TurkishStemmer__r_mark_yUmlab10_TurkishStemmer__r_mark_sUnlab11_TurkishStemmer__r_mark_yUzlab12lab13bra slice_del_TurkishStemmer__r_mark_DUrlab16lab15lab17lab18lab14_TurkishStemmer__r_mark_nUzlab19lab21lab20lab24lab23lab25lab26lab22lab27lab30lab29lab31lab32lab33lab34lab28) r|r}r~rrrv_6v_7v_8v_9v_10rrr__r_stem_nominal_verb_suffixesns                                                              z-TurkishStemmer.__r_stem_nominal_verb_suffixesc Cs|j|_|s dSz|j|j}z|st|j|_|s&WWdS|j|j}z|j|_z|j|j}z9|s@t |j|_|sOWWWWWdS|j|j}z| sc|j||_t Wt t yqYt wt yzYnw|j||_| s|j||_t|j|_|sWWWWdS|j|j}z/|j|_|s|j||_t|j|_|sWWWWWdS| s|j||_tWn tyYnwWWtWWtt yYWtwtyYtwtyYnw|j||_z#|st|j|_|s#WWdS|j|j}z|j|_z|j|j}z|s>t|j|_|sNWWWWWdSttyZYnw|j||_z|j|_z,|j|j}z | svtttyYnw|j||_|stWn tyYnw|j|_|sWWWWWdS|j|j} z5|j|_|s|j| |_t|j|_|sWWWWWWdS| s|j| |_tWttyYtwtyYnw|j||_| s|j||_tWWtty$YWtwty0Ytwty:Ynw|j||_|sIWdSz|j|j} z|sYt|j|_|sgWWWdSttysYnw|j| |_z\|st|j|_|sWWWdS|j|j} z3|j|_|s|j| |_t |j|_|sWWWWdS| s|j| |_t Wtt yYtwtyYnw|j| |_| sWWdSWWdStyYWdSwty YdSwNFT)!rir_TurkishStemmer__r_mark_kirh_TurkishStemmer__r_mark_DArmrrrrt._TurkishStemmer__r_stem_suffix_chain_before_kirvrr#_TurkishStemmer__r_mark_possessivesrprxro_TurkishStemmer__r_mark_nUnrz_TurkishStemmer__r_mark_lArIrrrr_TurkishStemmer__r_mark_sUrrr_TurkishStemmer__r_mark_ndArrrr) r|r}r~rrrrrrrr v_11rrr__r_stem_suffix_chain_before_kiJsn                                                    z.TurkishStemmer.__r_stem_suffix_chain_before_kicCs@z|j|j}z:|j|_|st|j|_|s WWdS|j|j}z|s4|j||_tWt tyBYt wtyKYnw|j||_z@|j|_| s_t |j|_|skWWdS|j|j}zz|j|j}z|j|_| st |j|_|sWWWWWdStt yYnw|j||_z|j|_z)|j|j}z |stttyYnw|j||_|stWn tyYnw|j|_|sWWWWWdS|j|j}z5|j|_|s|j||_t|j|_|sWWWWWWdS|s'|j||_tWtty6Ytwty@Ynw|j||_|j|_|sY|j||_t|j|_|shWWWWdS|sv|j||_tWWt tyYWt wtyYt wt yYnw|j||_z|j|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t tGyxYt wtCyYnw|j||_|j|_z-|j|j}z |stHtItHyYnw|j||_|sWWdSWn tIyYnw|j|_|sWdS|j|j}z1|j|_|s|j||_tJ|j|_|sWWdS|s|j||_tJWWdStJyYWdSwt yYdSwr )Krhrirrrmrrrrpro_TurkishStemmer__r_mark_ncArrrrxrvrrrrrzrrtrrr_TurkishStemmer__r_mark_nArrrrr_TurkishStemmer__r_mark_ndAnrr_TurkishStemmer__r_mark_nUrrrr_TurkishStemmer__r_mark_DAnrrrrrrrrrr_TurkishStemmer__r_mark_ylArlab36lab35lab39lab38lab37lab40rlab41lab42r lab45lab44_TurkishStemmer__r_mark_yUlab46_TurkishStemmer__r_mark_yAlab43lab49lab50lab48lab47lab52lab51lab53)r|r}r~rrrrrrrr rv_12v_13v_14v_15v_16v_17v_18v_19v_20v_21v_22v_23v_24v_25v_26v_27rrr__r_stem_noun_suffixess                                                                                                                                                   z%TurkishStemmer.__r_stem_noun_suffixescCs|j|_|tj}|dkrdS|j|_|dkr!|dsdSd S|dkr.|ds,dSd S|dkr;|ds9dSd S|d sBdSd S) NrUFrprNçrPtkT)rirrra_23r slice_from)r| among_varrrr __r_post_process_last_consonantss(      z/TurkishStemmer.__r_post_process_last_consonantsc Cs|j|j}z+|j|j}z |dsttty!Ynw|j||_|ds0WdSWn ty:Ynw|j||_z|j|j}z^|j|j}|tjdds[tz+|j|j}z |dskt t t yvYnw|j||_|dstWn t yYnw|j||_|j}| |j|jd||_t tyYnw|j||_z^|j|j}|tjddst z+|j|j}z |dstttyYnw|j||_|d st Wn tyYnw|j||_|j}| |j|jd ||_t t yYnw|j||_zc|j|j} |tjdds9tz.|j|j} z |d sJtttyVYnw|j| |_|d sftWn tyqYnw|j| |_|j}| |j|jd ||_t tyYnw|j||_|j|j} |tjddsWdSz/|j|j} z |d stttyYnw|j| |_|d sWWdSWn tyYnw|j| |_|j}| |j|jd ||_WdSt yYdSw)NrOgFrZr[rr^rr_rarfrdrgT)rhrirlrmrorjrrkrrrvrtinsertrprxrrzrrrrr) r|r}r~rrrrMrrrrr rrrr(__r_append_U_to_stems_ending_with_d_or_gs                                  z7TurkishStemmer.__r_append_U_to_stems_ending_with_d_or_gcCsb|dsdS|j|j}z|ds|j||_tWn ty&Ynw|j|jkr/dSdS)NadFsoyT)rlrhriror)r|r}rrr__r_is_reserved_word&s     z#TurkishStemmer.__r_is_reserved_wordcCst|j}d} |j}z|tjddst|jd7_|d8}Wqty*Ynw||_ |dkr5dS||_dS)NrNTrZr[rrUF)rigo_out_groupingrrkror|r}r~rrrr__r_more_than_one_syllable_word3s"z.TurkishStemmer.__r_more_than_one_syllable_wordcCs|j|_|j|_|j|j}z |stWdSty!Ynw|j||_|j|j}||j||_|j|j}||j||_|j|_dSr )rirrh#_TurkishStemmer__r_is_reserved_wordro7_TurkishStemmer__r_append_U_to_stems_ending_with_d_or_g/_TurkishStemmer__r_post_process_last_consonantsrQrrr __r_postludeFs"      zTurkishStemmer.__r_postludecCs~|sdS|j|_|j|_|j|j}||j||_|js#dS|j|j}||j||_|j|_|s=dSdSr )._TurkishStemmer__r_more_than_one_syllable_wordrirrh-_TurkishStemmer__r_stem_nominal_verb_suffixesr%_TurkishStemmer__r_stem_noun_suffixes_TurkishStemmer__r_postluder{rrr_stemYs     zTurkishStemmer._stemN)O__name__ __module__ __qualname____doc__rrrrrrrrrrrrrrrrrrrrrrrrrFrkrrnrqrsrurwryrrrrrrrrrr&rrr(rr rrrrr rrrrrrrrrrrrrrXrrYrUrTrSrWrZr[rrrrrs                                                                                                        $              F              ])<g  rc@ eZdZdS)roNr\r]r^rrrrrol roc@r`)rmNrarrrrrmorbrmc@r`)rpNrarrrrrprrbrpc@r`)rrNrarrrrrrurbrrc@r`)rtNrarrrrrtxrbrtc@r`)rvNrarrrrrv{rbrvc@r`)rxNrarrrrrx~rbrxc@r`)rzNrarrrrrzrbrzc@r`)rNrarrrrrrbrc@r`)rNrarrrrrrbrc@r`)rNrarrrrrrbrc@r`)rNrarrrrrrbrc@r`)r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