flashgeotext
v0.5.3
Aho-Corasick 구현인 FlashText를 사용하여 스테로이드의 GeoText와 같이 텍스트에서 국가 및 도시(+동의어)를 추출하고 계산합니다. Flashgeotext는 입력 텍스트에서 하나 이상의 지정된 도시 및 국가 이름(+ 동의어) 세트를 추출하는 빠른 배터리 포함(및 BYOD) 기본 Python 라이브러리입니다.
소개 블로그 게시물 : 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 파일을 참조하세요.
Creative Commons Attribution 3.0 라이선스에 따라 라이선스가 부여된 http://www.genames.org의 데모 데이터 도시입니다.