๋๋ ์ฝ์ด๊ฐ ํฌํจ๋ ๋ฌธ์ฅ์ ๋ถํ ํ๋ ๊ฒ์ด ์ผ๋ง๋ ์ด๋ ค์ด์ง์ #2154์ ์ ์ค๋ช ๋์ด ์๋ ๊ฒ์ฒ๋ผ ์ฝ์ด๋ฅผ ์ถ๊ฐํ๋ฉด ํจ์ ์ด ์์ ์ ์๋ค๋ ๊ฒ์ ์ดํดํฉ๋๋ค. ๊ทธ๋ฌ๋, ๋๋ ๋ด๊ฐ ๋ฌป๊ณ ์ถ์ ๋ช ๊ฐ์ง ์ฝ๋ ์ผ์ด์ค๋ฅผ ์ฐ์ฐํ ๋ฐ๊ฒฌํ์ต๋๋ค. ๋ค์ ์ค ํ๋๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค.
๋ฌธ์ฅ์์ ์๋ชป๋ ๋ฐฉ์์ผ๋ก ๋ฌธ์ฅ์ ๋ถํ ํฉ๋๋ค.
ie ๋ฐ eg์ ์
>>> sentence = ("Even though exempli gratia and id est are both Latin "
"(and therefore italicized), no need to put e.g. or i.e. in "
"italics when theyโre in abbreviated form.")
>>> sent_tokenize_list = sent_tokenize(sentence)
>>> sent_tokenize_list
['Even though exempli gratia and id est are both Latin (and therefore italicized), no need to put e.g.',
'or i.e.',
'in italics when theyโre in abbreviated form.']
et al.
>>> from nltk.tokenize import sent_tokenize
>>> sentence = ("If David et al. get the financing, we can move forward "
"with the prototype. However, this is very unlikely be cause "
"they did not publish sufficiently last year.")
>>> sent_tokenize_list = sent_tokenize(sentence)
>>> sent_tokenize_list
['If David et al.',
'get the financing, we can move forward with the prototype.',
'However, this is very unlikely because they did not publish sufficiently last year.']
๋ด ๋
ธํธ๋ถ์์ nltk.__version__
3.4.5๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
๋ด๊ฐ ๋ณด๊ธฐ์ ์ด ๋ฌธ์ ๋ ์ ์๋ ค์ ธ ์๊ณ ์ผ๋ฐ์ ์ผ๋ก ์ฌ์ฉ๋๋ ์ฝ์ด(ํนํ ํ๊ณ์์) ๋๋ฌธ์ #2154์ ๋ค๋ฆ ๋๋ค.
#2154์ ์ด์ด ๋น ๋ฅธ ํดํน
>>> import nltk
>>> punkt = nltk.data.load('tokenizers/punkt/english.pickle')
>>> punkt._params.abbrev_types.add('al')
>>> text = 'If David et al. get the financing, we can move forward with the prototype. However, this is very unlikely be cause they did not publish sufficiently last year.'
>>> punkt.tokenize(text)
['If David et al. get the financing, we can move forward with the prototype.',
'However, this is very unlikely be cause they did not publish sufficiently last year.']
๊ทธ๋ฌ๋ ์๋ง๋ ์ฐ๋ฆฌ๊ฐ ๋จ์ด ํ ํฌ๋์ด์ (#2355)๋ก ํ๋ ๊ฒ๊ณผ ๊ฐ์ด ๊ฐ์ ๋ ๋ฌธ์ฅ ํ ํฌ๋์ด์ (#2008, #1214)๋ฅผ ๊ฐ๋ ๊ฒ์ด ์ข์ ์๊ฐ์ผ ๊ฒ์ ๋๋ค.
์๋ฅผ ๋ค์ด ์ฒซ ๋ฒ์งธ ๋จ๊ณ๋ก ๋ชจ๋ nltk.corpus.nonbreaking_prefixes
์์ punkt._params.abbrev_types
๊น์ง ์ฝ๊ฒ ํ ์ ์์ต๋๋ค.
์ด ๋ผ์ธ์ ๋ฐ๋ผ ๋ฌธ์ ๋ฅผ ์ถ๊ฐํ๋ ค๊ณ ํ์ผ๋ ๋น์ ์ด ๊ทธ๊ฒ์ ๋ํด ์ ๋ฅผ ๋๋ฆฐ ๊ฒ์ ๋ณด์์ต๋๋ค. ์ฌ๋๋ค์ด ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๊ณ ํ ๋ ์ฌ๊ธฐ์์ ๋ผํด์ด ์ฝ์ด ๋ชฉ๋ก์ ๊ฒํ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
https://en.wikipedia.org/wiki/List_of_Latin_abbreviations
์๋ฐํ ๋งํ๋ฉด ์์ ํ ์ฐ์ฌ์ง๊ณ ์ถ์ฝ๋์ง ์์ ํํ์ ์ด๋ฌํ ์ฝ์ด๋ _๋ค์ค ๋จ์ด ํํ_(_MWEs_)์ ๋ํ๋ ๋๋ค. ์๋์? ๋ด ๋ง์, ์๊ฒ ์ต๋๋ค. ๊ธฐ์ ์ ์ผ๋ก ๊ทธ๋ค์ (์ญ์) ๊ณ ์ _๊ตฌ๋ฌธ ํ ํ๋ฆฟ_์ ๋ํ๋ด์ง๋ง MWE ์ํ๋ฅผ ๋ณ๊ฒฝํ์ง ์์ผ๋ฏ๋ก #2202๊ฐ ์ด ๋ฌธ์ ์ ๋์์ด ๋ ์ ์๋์ง ๊ถ๊ธํฉ๋๋ค. ") ๐ค
(์ถ์ , ์ฌ๋ฏธ์๋ ์ฌ์ค: '& al.'์ 'et al.'์ ๋ฒ์ ์ค์๋ง์ด๊ณ '&c.'๋ 'etc.'์ ๋ฒ์ ์ค์๋ง์ ๋๋ค.)
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
#2154์ ์ด์ด ๋น ๋ฅธ ํดํน
๊ทธ๋ฌ๋ ์๋ง๋ ์ฐ๋ฆฌ๊ฐ ๋จ์ด ํ ํฌ๋์ด์ (#2355)๋ก ํ๋ ๊ฒ๊ณผ ๊ฐ์ด ๊ฐ์ ๋ ๋ฌธ์ฅ ํ ํฌ๋์ด์ (#2008, #1214)๋ฅผ ๊ฐ๋ ๊ฒ์ด ์ข์ ์๊ฐ์ผ ๊ฒ์ ๋๋ค.
์๋ฅผ ๋ค์ด ์ฒซ ๋ฒ์งธ ๋จ๊ณ๋ก ๋ชจ๋
nltk.corpus.nonbreaking_prefixes
์์punkt._params.abbrev_types
๊น์ง ์ฝ๊ฒ ํ ์ ์์ต๋๋ค.