flashgeotext
v0.5.3
แยกและนับประเทศและเมือง (+คำพ้องความหมาย) จากข้อความ เช่น GeoText บนสเตียรอยด์โดยใช้ FlashText ซึ่งเป็นการนำ Aho-Corasick Flashgeotext เป็นไลบรารีหลามแบบเนทิฟที่รวดเร็วและรวมแบตเตอรี่ (และ BYOD) ซึ่งจะแยกชุดชื่อเมืองและประเทศที่กำหนดตั้งแต่หนึ่งชุดขึ้นไป (+ คำพ้องความหมาย) ออกจากข้อความอินพุต
บล็อกโพสต์เบื้องต้น : https://iwpnd.github.io/articles/2020-02/flashgeotext-library
from flashgeotext . geotext import GeoText
geotext = GeoText ()
input_text = '''Shanghai. The Chinese Ministry of Finance in Shanghai said that China plans
to cut tariffs on $75 billion worth of goods that the country
imports from the US. Washington welcomes the decision.'''
geotext . extract ( input_text = input_text )
>> {
'cities' : {
'Shanghai' : {
'count' : 2 ,
'span_info' : [( 0 , 8 ), ( 45 , 53 )],
'found_as' : [ 'Shanghai' , 'Shanghai' ],
},
'Washington, D.C.' : {
'count' : 1 ,
'span_info' : [( 175 , 185 )],
'found_as' : [ 'Washington' ],
}
},
'countries' : {
'China' : {
'count' : 1 ,
'span_info' : [( 64 , 69 )],
'found_as' : [ 'China' ],
},
'United States' : {
'count' : 1 ,
'span_info' : [( 171 , 173 )],
'found_as' : [ 'US' ],
}
}
}
คำแนะนำเหล่านี้จะทำให้คุณได้รับสำเนาของโปรเจ็กต์และทำงานบนเครื่องของคุณเพื่อการพัฒนาและการทดสอบ
ปิ๊บ:
pip install flashgeotext
คอนดา:
conda install flashgeotext
เพื่อการพัฒนา:
git clone https://github.com/iwpnd/flashgeotext.git
cd flashgeotext/
poetry install
poetry run pytest . -v
ดูรายชื่อผู้ร่วมให้ข้อมูลที่เข้าร่วมโครงการนี้ด้วย
โครงการนี้ได้รับอนุญาตภายใต้ใบอนุญาต MIT - ดูรายละเอียดในไฟล์ LICENSE.md
เมืองข้อมูลสาธิตจาก http://www.geonames.org ได้รับอนุญาตภายใต้ใบอนุญาต Creative Commons Attribution 3.0