ffreemt commited on
Commit
8dfbb39
·
1 Parent(s): 9d78035

Fix running in localhost for share.streamlit.io and pysbd for nepoli

Browse files
.ruff.toml CHANGED
@@ -17,6 +17,7 @@ lint.select = ["F", "E", "W", "I001", "YTT", "D", "PLC"]
17
  # Missing dashed underline after section ("Args") (D407)
18
  # D413 [*] Missing blank line after last section ("Returns")
19
  # D213 [*] Multi-line docstring summary should start at the second line
20
- lint.extend-ignore = ["D103", "D101", "D212", "D203", "F401", "F841", "D407", "D413", "D213"]
 
21
 
22
  exclude = [".venv"]
 
17
  # Missing dashed underline after section ("Args") (D407)
18
  # D413 [*] Missing blank line after last section ("Returns")
19
  # D213 [*] Multi-line docstring summary should start at the second line
20
+ # I001 [*] Import block is un-sorted or un-formatted
21
+ lint.extend-ignore = ["D103", "D101", "D212", "D203", "F401", "F841", "D407", "D413", "D213", "I001"]
22
 
23
  exclude = [".venv"]
data/test_en.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Wuthering Heights
2
+
3
+
4
+ --------------------------------------------------------------------------------
5
+
6
+ Chapter 2
7
+
8
+ Chinese
9
+
10
+
11
+ Yesterday afternoon set in misty and cold. I had half a mind to spend it by my study fire, instead of wading through heath and mud to Wuthering Heights. On coming up from dinner, however (N.B. I dine between twelve and one o'clock; the housekeeper, a matronly lady, taken as a fixture along with the house, could not, or would not, comprehend my request that I might be served at five), on mounting the stairs with this lazy intention, and stepping into the room, I saw a servant girl on her knees surrounded by brushes and coal-scuttles, and raising an infernal dust as she extinguished the flames with heaps of cinders. This spectacle drove me back immediately; I took my hat, and, after a four-miles' walk, arrived at Heathcliff's garden gate just in time to escape the first feathery flakes of a snow shower.
12
+
13
+ On that bleak hill top the earth was hard with a black frost, and the air made me shiver through every limb. Being unable to remove the chain, I jumped over, and, running up the flagged causeway bordered with straggling gooseberry bushes, knocked vainly for admittance, till my knuckles tingled and the dogs howled.
14
+
15
+ `Wretched inmates!' I ejaculated mentally, `you deserve perpetual isolation from your species for your churlish inhospitality. At least, I would not keep my doors barred in the day time. I don't care--I will get in!' So resolved, I grasped the latch and shook it vehemently. Vinegar-faced Joseph projected his head from a round window of the barn.
16
+
17
+ `Whet are ye for?' he shouted. `T' maister's dahn i' t' fowld. Go rahnd by th' end ut' laith, if yah went tuh spake tull him.'
18
+
19
+ `Is there nobody inside to open the door?' I hallooed, responsively.
20
+
21
+ `They's nobbut t' missis; and shoo'll nut oppen't an ye mak yer flaysome dins till neeght.'
22
+
23
+ `Why? Cannot you tell her who I am, eh, Joseph?'
24
+
25
+ `Nor-ne me! Aw'll hae noa hend wi't,' muttered the head, vanishing.
26
+
27
+ The snow began to drive thickly. I seized the handle to essay another trial; when a young man without coat, and shouldering a pitchfork, appeared in the yard behind. He hailed me to follow him, and, after marching through a wash-house, and a paved area containing a coal shed, pump, and pigeon cot, we at length arrived in the huge, warm, cheerful apartment, where I was formerly received. It glowed delightfully in the radiance of an immense fire, compounded of coal, peat, and wood; and near the table, laid for a plentiful evening meal, I was pleased to observe the `missis', an individual whose existence I had never previously suspected. I bowed and waited, thinking she would bid me take a seat. She looked at me, leaning back in her chair, and remained motionless and mute.
28
+
29
+ `Rough weather!' I remarked. `I'm afraid, Mrs Heathcliff, the door must bear the consequence of your servants' leisure attendance: I had hard work to make them hear me.'
30
+
31
+ She never opened her mouth. I stared--she stared also: at any rate, she kept her eyes on me in a cool, regardless manner, exceedingly embarrassing and disagreeable.
32
+
33
+ `Sit down,' said the young man gruffly. `He'll be in soon.'
34
+
35
+ I obeyed; and hemmed, and called the villain Juno, who deigned, at this second interview, to move the extreme tip of her tail, in token of owning my acquaintance.
36
+
37
+ `A beautiful animal!' I commenced again. `Do you intend parting with the little ones, madam?'
38
+
39
+ `They are not mine,' said the amiable hostess, more repellingly than Heathcliff himself could have replied.
40
+
41
+ `Ah, your favourites are among these?' I continued, turning to an obscure cushion full of something like cats.
42
+
43
+ `A strange choice of favourites!' she observed scornfully.
44
+
45
+ Unluckily, it was a heap of dead rabbits. I hemmed once more, and drew closer to the hearth, repeating my comment on the wildness of the evening.
46
+
47
+ `You should not have come out,' she said, rising and reaching from the chimney-piece two of the painted canisters.
48
+
49
+ Her position before was sheltered from the light; now, I had a distinct view of her whole figure and countenance. She was slender, and apparently scarcely past girlhood: an admirable form, and the most exquisite little face that I have ever had the pleasure of beholding; small features, very fair; flaxen ringlets, or rather golden, hanging loose on her delicate neck; and eyes, had they been agreeable in expression, they would have been irresistible: fortunately for my susceptible heart, the only sentiment they evinced hovered between scorn, and a kind of desperation, singularly unnatural to be detected there. The canisters were almost out of her reach; I made a motion to aid her; she turned upon me as a miser might turn if anyone attempted to assist him in counting his gold.
50
+
51
+ `I don't want your help,' she snapped; `I can get them for myself.'
52
+
53
+ `I beg your pardon!' I hastened to reply.
54
+
55
+ `Were you asked to tea?' she demanded, tying an apron over her neat black frock, and standing with a spoonful of the leaf poised over the pot.
56
+
57
+ `I shall be glad to have a cup,' I answered.
58
+
59
+ `Were you asked?' she repeated.
60
+
61
+ `No,' I said, half smiling. `You are the proper person to ask me.'
62
+  
63
+
64
+
65
+ Contents PreviousChapter
66
+ NextChapter
67
+
68
+
69
+ Homepage
data/test_ne_googletr.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Wuthering हाइट्स
2
+
3
+
4
+
5
+ हिजो दिउँसो चिसो र कुहिरो थियो । म विथरिङ हाइट्समा झार र माटोबाट हिंड्नुको सट्टा अध्ययनमा फायरसाइडमा दिउँसो बिताउन चाहन्छु।
6
+
7
+ तर खाजा पछि (नोट - मैले बाह्र र एक बजेको बीचमा मेरो खाजा खाएँ), घरको परिशिष्ट मानिने दयालु महिलाले मेरो अनुरोध बुझ्न सकेनन् वा गर्नुहुन्न। (उद्देश्य पाँच बजे बेलुकाको खाना खाएको) यो अल्छी सोच लिएर माथिल्लो तलामा गएर घरभित्र पस्दा, भुइँमा घुँडा टेकेर एउटा कामदारलाई झाडु र कोइलाको छेउमा टेकेको देखेँ । धूलोको बादल सिर्जना गर्दै सिन्डरको थुप्रोले आगोलाई बन्द गरिरहेकी थिइन्। त्यो दृश्यले मलाई तुरुन्तै फर्काइदियो। म मेरो टोपी लिएर हिथक्लिफको बगैंचाको प्रवेशद्वारमा चार माइल हिंडें, यो वर्षको सुरुमा खसेको भारी हिमपातबाट बच्न ठीक समयमा।
8
+
9
+ त्यो सुनसान पहाडको टुप्पोमा कालो बरफको तहले जमिन जमेको थियो र चिसो हावाले मेरो हात-खुट्टा काँप्यो। चेन खोल्न नसकेर म भित्र हाम फालेँ र गुजबेरीका झाडीहरू फैलिएको ढुङ्गाको बाटोमा दौडें। मैले धेरै बेरसम्म ढोका ढकढक्याएँ, जबसम्म मेरो औंलाको हड्डी दुखेन र कुकुर भुक्न थाल्यो।
10
+
11
+ "गरिब मान्छे!" मैले मनमनै रोएँ। "तिमीले पाहुनाहरूसँग यत्तिको असभ्य व्यवहार गरेकोले जीवनभरको लागि संसारबाट अलग्नुपर्छ। कम्तिमा म दिउँसो ढोका ढकढक गर्दिनँ। वास्ता नगर्नुहोस् - म भित्र जान चाहन्छु!" त्यसैले निर्णय गरे। मैले कुंडी समातेर कडा हल्लाएँ। एक रमाइलो जोसेफले गोदामको गोलाकार झ्यालबाट आफ्नो टाउको बाहिर निकाले।
12
+
13
+ "के गर्दै छौ?" उसले चिच्यायो। "मास्टर बुल्पेनमा हुनुहुन्छ। यदि तपाईं उहाँसँग कुरा गर्न चाहनुहुन्छ भने, यो चौराहेमा जानुहोस्।"
14
+
15
+ “घरमा कसैले ढोका खोलेको छैन ?” म पनि चिच्याएँ ।
16
+
17
+ "मेरी श्रीमतीबाहेक अरू कोही छैन। राती अबेरसम्म दृश्य बनाउनुभयो भने पनि गाडी चलाउनुहुन्न।"
18
+
19
+ "किन? के तिमी उसलाई म को हुँ भन्न सक्दैनौ, जोसेफ?"
20
+
21
+ "मलाई नखोज्नुहोस्! म त्यस्ता साना कुराहरूको वास्ता गर्दिनँ," टाउको गुनगुनायो र फेरि गायब भयो।
22
+
23
+ भारी हिउँ पर्न थाल्यो । मैले ढोकाको ह्यान्डल समातेर फेरि प्रयास गरें। यस समयमा, कोट बिना एक युवक, घाँसको रेक बोकेको, पछाडिको आँगनमा देखा पर्‍यो। उहाँले मलाई उहाँलाई पछ्याउन निम्तो दिनुभयो, र हामी एउटा लुगा धुने र एउटा कोइलाको शेड, पानीको पम्प र एउटा परेवा��ो कूप भएको पक्की क्षेत्र हुँदै गयौं, जबसम्म हामी अन्ततः मलाई अन्तिम पटक स्वागत गरिएको ठूलो, न्यानो, जीवन्त कोठामा पुग्यौं। कोइला, कोइला र काठ एकै ठाउँमा मिसाएको आगोले घरलाई उज्यालो बनायो। टेबुलमा जहाँ भव्य रात्रिभोज राखिएको थियो, म "श्रीमती" लाई देखेर खुसी भएँ, जसको अस्तित्व मैले कहिल्यै सोचेको थिइनँ। म झुकेर पर्खिरहेछु, उसले मलाई बस्न भन्नुहुन्छ भन्ने आशामा। उसले मलाई हेरी, आफ्नो कुर्सीमा पछाडि झुक्यो, र हिँडिन वा आवाज निकालिन।
24
+
25
+ "मौसम साँच्चै खराब छ!" मैले भनें। "श्रीमती हेथक्लिफ, मलाई डर छ कि ढोका तपाईंका सेवकहरूको अल्छीपनबाट पीडित छ। मलाई ढकढक्याएको सुन्न उनीहरूलाई गाह्रो भयो!"
26
+
27
+ उनले बोल्न अस्वीकार गरिन् । मैले हेरें - र उनी पनि हेरिन्। जे होस्, उनी सधैं मलाई चिसो, उदासीन नजरले हेरिरहिन्, जुन धेरै लाजमर्दो र अप्रिय थियो।
28
+
29
+ "बस्नुहोस्," युवकले रिसाउँदै भन्यो, "उहाँ आउँदै हुनुहुन्छ।"
30
+
31
+ मैले आज्ञा पालन गरें; मैले अलिकति खोकें र जुनो, दुष्ट कुकुरलाई बोलाएँ। जब हामी दोस्रो पटक भेट्यौं, उहाँले अन्ततः मेरो प्रशंसा गर्नुभयो र उहाँको पुच्छरको टुप्पोले मलाई एक परिचितको रूपमा चिन्नु भयो भनेर देखाउनुभयो।
32
+
33
+ "कस्तो सुन्दर कुकुर!" मैले फेरि बोल्न थालें। "के तपाई यी सानालाई हटाउने योजनामा ​​हुनुहुन्छ, म्याडम?"
34
+
35
+ "तिनीहरू मेरा होइनन्," मिठाई परिचारिकाले भनिन्, हेथक्लिफले आफैंले भन्दा बढी चिसो जवाफ दिन सक्थे।
36
+
37
+ "ए, तपाइँको मनपर्ने चीज यो थुप्रोमा छ!" मैले पछाडि फर्केर अदृश्य कुसनमा बिरालो जस्तै चीजहरूको थुप्रोलाई औंल्याएँ, र जारी राखें।
38
+
39
+ "कसलाई यी चीजहरू मनपर्छ? यो अनौठो छ!" उनले अपमानजनक रूपमा भनिन्।
40
+
41
+ दुर्भाग्यवश, यो मरेको खरायो को ढेर भयो। म फेरि खोकेँ, चुलोको नजिक गएँ, र आज राती खराब मौसममा टिप्पणी गरें।
42
+
43
+ "पहिले तपाइ बाहिर आउनु पर्दैनथ्यो," उनले मन्टलपीसमा दुई रङ्गीन चियाका क्यान लिन उठेर भनिन्।
44
+
45
+ उज्यालो अवरुद्ध भएको ठाउँमा उनी बसिरहेकी थिइन्, तर अब मैले उनको पूरै शरीर र अनुहार स्पष्ट देख्न पाएको थिएँ। उनी पातलो थिइन् र स्पष्ट रूपमा यौवन बितेको थिएन। उनीसँग एक सुन्दर फिगर र एउटा अद्भुत सानो अनुहार छ जुन मैले मेरो जीवनमा कहिल्यै देखेको रमाइलो छैन। उनीसँग नाजुक अनुहार सुविधाहरू छन् र धेरै सुन्दर छिन्। हल्का पहेँलो कर्ल, वा बरु सुनौलो कपाल, उनक��� नाजुक घाँटीमा ढिलो झुण्डिएको थियो। आँखाको लागि, यदि तिनीहरू अधिक रमाइलो थिए भने, तिनीहरू अपरिहार्य हुनेछन्। यो मेरो प्रभावशाली हृदयको लागि असामान्य थिएन, किनकि तिनीहरूले अवहेलना र केही नजिक पुग्ने निराशा बीचको भावनालाई मात्र प्रतिनिधित्व गर्थे, र त्यो अनुहारमा यस्तो हेराई देख्नु अनौठो रूपमा अप्राकृतिक थियो।
46
+
47
+ उनी मुस्किलले चियाको भाँडोमा पुग्न सकिनन् । म उसलाई मद्दत गर्न चाहन्छु, सारियो। उसले आफ्नो सुन गन्ने कसैलाई मद्दत गर्न खोजेको देखे जस्तो कंजूस जस्तो गरी तिनी म तिर फर्किन्।
48
+
49
+ "म तिम्रो मद्दत चाहन्न," उनले रिसाउँदै भनिन्, "म आफैले पाउन सक्छु।"
50
+
51
+ "माफ गर्नुहोस्!" मैले छिटो जवाफ दिएँ।
52
+
53
+ “तिमी यहाँ चिया पिउन आएकी छौ ?” आफ्नो सफा कालो लुगामा एप्रन बाँधेर उभिर एक चम्चा चिया पात लिएर चियाको भाँडोमा हाल्न लागेकी उनले सोधिन् ।
54
+
55
+ "मलाई एक कप चिया मन पर्छ," मैले जवाफ दिए।
56
+
57
+ "तिमी यतै आयौ?" उसले फेरि सोधी।
58
+
59
+ "होइन," मैले जबरजस्ती मुस्कुराउँदै भनें। "तिमी मलाई चिया पिउन बोलाउन चाहन्छौ।"
60
+
61
+ को
62
+
63
+
64
+ सामग्री तालिका
65
+ अघिल्लो अध्याय
66
+ अर्को अध्याय
67
+
68
+
69
+ गृहपृष्ठमा फर्कनुहोस्
data/test_zh.txt ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 呼啸山庄
2
+
3
+ --------------------------------------------------------------------------------
4
+
5
+ 第二章
6
+
7
+ 英文
8
+
9
+
10
+ 昨天下午又冷又有雾。我想就在书房炉边消磨一下午,不想踩着杂草污泥到呼啸山庄了。
11
+
12
+ 但是,吃过午饭(注意——我在十二点与一点钟之间吃午饭,而可以当作这所房子的附属物的管家婆,一位慈祥的太太却不能,或者并不愿理解我请求在五点钟开饭的用意),在我怀着这个懒惰的想法上了楼,迈进屋子的时候,看见一个女仆跪在地上,身边是扫帚和煤斗。她正在用一堆堆煤渣封火,搞起一片弥漫的灰尘。这景象立刻把我赶回头了。我拿了帽子,走了四里路,到达了希刺克厉夫的花园口口,刚好躲过了一场今年初降的鹅毛大雪。
13
+
14
+ 在那荒凉的山顶上,土地由于结了一层黑冰而冻得坚硬,冷空气使我四肢发抖。我弄不开门链,就跳进去,顺着两边种着蔓延的醋栗树丛的石路跑去。我白白地敲了半天门,一直敲到我的手指骨都痛了,狗也狂吠起来。
15
+
16
+ “倒霉的人家!”我心里直叫,“只为你这样无礼待客,就该一辈子跟人群隔离。我至少还不会在白天把门闩住。我才不管呢——我要进去!”如此决定了。我就抓住门闩,使劲摇它。苦脸的约瑟夫从谷仓的一个圆窗里探出头来。
17
+
18
+ “你干吗?”他大叫。“主人在牛栏里,你要是找他说话,就从这条路口绕过去。”
19
+
20
+ “屋里没人开门吗?”我也叫起来。
21
+
22
+ “除了太太没有别人。你就是闹腾到夜里,她也不会开。”
23
+
24
+ “为什么?你就不能告诉她我是谁吗,呃,约瑟夫?”
25
+
26
+ “别找我!我才不管这些闲事呢,”这个脑袋咕噜着,又不见了。
27
+
28
+ 雪开始下大了。我握住门柄又试一回。这时一个没穿外衣的年轻人,扛着一根草耙,在后面院子里出现了。他招呼我跟着他走,穿过了一个洗衣房和一片铺平的地,那儿有煤棚、抽水机和鸽笼,我们终于到了我上次被接待过的那间温暖的、热闹的大屋子。煤、炭和木材混合在一起燃起的熊熊炉火,使这屋子放着光彩。在准备摆上丰盛晚餐的桌旁,我很高兴地看到了那位“太太”,以前我从未料想到会有这么一个人存在的。我鞠躬等候,以为她会叫我坐下。她望望我,往她的椅背一靠,不动,也不出声。
29
+
30
+ “天气真坏!”我说,“希刺克厉夫太太,恐怕大门因为您的仆人偷懒而大吃苦头,我费了好大劲才使他们听见我敲门!”
31
+
32
+ 她死不开口。我瞪眼——她也瞪眼。反正她总是以一种冷冷的、漠不关心的神气盯住我,使人十分窘,而且不愉快。
33
+
34
+ “坐下吧,”那年轻人粗声粗气地说,“他就要来了。”
35
+
36
+ 我服从了;轻轻咳了一下,叫唤那恶狗朱诺。临到第二次会面,它总算赏脸,摇起尾巴尖,表示认我是熟人了。
37
+
38
+ “好漂亮的狗!”我又开始说话。“您是不是打算不要这些小的呢,夫人?”
39
+
40
+ “那些不是我的,”这可爱可亲的女主人说,比希刺克厉夫本人所能回答的腔调还要更冷淡些。
41
+
42
+ “啊,您所心爱的是在这一堆里啦!”我转身指着一个看不清楚的靠垫上那一堆像猫似的东西,接着说下去。
43
+
44
+ “谁会爱这些东西那才怪呢!”她轻蔑地说。
45
+
46
+ 倒霉,原来那是堆死兔子。我又轻咳一声,向火炉凑近些,又把今晚天气不好的话评论一通。
47
+
48
+ “你本来就不该出来。”她说,站起来去拿壁炉台上的两个彩色茶叶罐。
49
+
50
+ 她原先坐在光线被遮住的地方,现在我把她的全身和面貌都看得清清楚楚。她苗条,显然还没有过青春期。挺好看的体态,还有一张我生平从未有幸见过的绝妙的小脸蛋。五官纤丽,非常漂亮。淡黄色的卷发,或者不如说是金黄色的,松松地垂在她那细嫩的颈上。至于眼睛,要是眼神能显得和悦些,就要使人无法抗拒了。对我这容易动情的心说来倒是常事,因为它们所表现的只是在轻蔑与近似绝望之间的一种情绪,而在那张脸上看见那样的眼神是特别不自然的。
51
+
52
+ 她简直够不到茶叶罐。我动了一动,想帮她一下。她猛地扭转身向我,像守财奴看见别人打算帮他数他的金子一样。
53
+
54
+ “我不要你帮忙,”她怒气冲冲地说,“我自己拿得到。”
55
+
56
+ “对不起!”我连忙回答。
57
+
58
+ “是请你来吃茶的吗?”她问,把一条围裙系在她那干净的黑衣服上,就这样站着,拿一匙茶叶正要往茶壶里倒。
59
+
60
+ “我很想喝杯茶。”我回答。
61
+
62
+ “是请你来的吗?”她又问。
63
+
64
+ “没有,”我说,勉强笑一笑。“您正好请我喝茶。”
65
+
66
+  
67
+
68
+
69
+ 目录
70
+ 上一章
71
+ 下一章
72
+
73
+
74
+ 返回首页
st_mlbee/home.py CHANGED
@@ -9,7 +9,7 @@ import inspect
9
  import io
10
  import platform
11
 
12
- # pylint: disable=invalid-name
13
  from functools import partial
14
  from itertools import zip_longest
15
 
@@ -166,8 +166,13 @@ def home(): # noqa
166
  diff_for_humans = eta.diff_for_humans()
167
  dt_str = eta.to_datetime_string()
168
  timezone_name = eta.timezone_name
 
 
 
 
 
169
  _ = (
170
- f"running in {uname.node} -- "
171
  f" processing {len1} + {len2} = {len12} blocks; "
172
  f"estimated time to complete: {in_words0} to {in_words1}; "
173
  f"eta: {diff_for_humans} ({dt_str} {timezone_name}) "
 
9
  import io
10
  import platform
11
 
12
+ from pathlib import Path
13
  from functools import partial
14
  from itertools import zip_longest
15
 
 
166
  diff_for_humans = eta.diff_for_humans()
167
  dt_str = eta.to_datetime_string()
168
  timezone_name = eta.timezone_name
169
+
170
+ running_in = uname.node
171
+ # streamlit.io mount to /mount/src/mlbee and uname.node set to 'localhost'
172
+ if Path("/mount/src/mlbee").exists() and running_in.startswith("local"):
173
+ running_in = "share.streamlit.io"
174
  _ = (
175
+ f"running in {running_in} -- "
176
  f" processing {len1} + {len2} = {len12} blocks; "
177
  f"estimated time to complete: {in_words0} to {in_words1}; "
178
  f"eta: {diff_for_humans} ({dt_str} {timezone_name}) "
st_mlbee/split_text.py CHANGED
@@ -57,7 +57,17 @@ def _seg_text(
57
  if not text.strip():
58
  return []
59
 
60
- seg = pysbd.Segmenter(language=lang, clean=True)
 
 
 
 
 
 
 
 
 
 
61
 
62
  try:
63
  # _ = tok.tokenize(text)
 
57
  if not text.strip():
58
  return []
59
 
60
+ # pysbd only understands {'ja', 'am', 'bg', 'ur', 'hi', 'de', 'da', 'fr', 'el', 'fa', 'ru', 'ar', 'my', 'kk', 'pl', 'sk', 'en', 'hy', 'zh', 'mr', 'nl', 'it', 'es'}, 23
61
+ try:
62
+ seg = pysbd.Segmenter(language=lang, clean=True)
63
+ except Exception as exc:
64
+ # fall back to 'en'
65
+ logger.error(exc)
66
+ logger.warning(
67
+ f" pysbd probably does not understand {lang} "
68
+ "fall back to 'en'"
69
+ )
70
+ seg = pysbd.Segmenter(language="en", clean=True)
71
 
72
  try:
73
  # _ = tok.tokenize(text)