Skip to content

Commit f470c8f

Browse files
committed
200th commits and counting
- updated nlp vowel harmony() to work with acronyms - updated inverse stemmer to work with acronyms and names, etc. - increased version number to 1.1.5 - added test.py to .gitignore
1 parent c234d96 commit f470c8f

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.pyc
22
.cache
33
*.bat
4+
test.py

lara/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Lara - Lingusitic Aim Recognizer API
44

55
__all__ = 'nlp','parser','stemmer','entities'
6-
__version__ = '1.1.3'
6+
__version__ = '1.1.5'
77
__version_info__ = tuple(int(num) for num in __version__.split('.'))
88

99
import sys

lara/nlp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,18 @@ def vowel_harmony(word, vegyes=True):
5555
magas = re.compile('[eéiíöőüű]', re.IGNORECASE)
5656
mely_m = len(mely.findall(word))
5757
magas_m = len(magas.findall(word))
58+
if not magas_m and not mely_m:
59+
if word[-1].lower() in ('h','k','q'):
60+
return 'mely'
61+
return 'magas'
5862
if magas_m and mely_m:
5963
if vegyes:
6064
return 'vegyes'
6165
return 'magas'
6266
if magas_m>mely_m:
6367
return 'magas'
6468
return 'mely'
65-
return 'hiba'
69+
return 'mely'
6670

6771
def is_vowel(letter):
6872
if letter:

lara/stemmer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,10 @@ def inverse(word,affix):
334334
word = lara.nlp.trim(word)
335335
if not word:
336336
return ''
337-
vh = lara.nlp.vowel_harmony(word)
337+
vh = lara.nlp.vowel_harmony(word.split()[-1])
338338
result = word
339+
if not result[-1].isalnum():
340+
result = result+"-"
339341
if affix in ('ra','re'):
340342
if word[-1].lower() in ('a','e'):
341343
result = result[:-1]+result[-1].replace('a','á').replace('e','é')

0 commit comments

Comments
 (0)