[Hejes-devel] [1464] spell.py: Anett-tel etc.
hejes-devel at nytud.hu
hejes-devel at nytud.hu
Wed Sep 2 23:28:25 CEST 2015
Revision: 1464
Author: mihaltz
Date: 2015-09-02 23:28:24 +0200 (Wed, 02 Sep 2015)
Log Message:
-----------
spell.py: Anett-tel etc. works
Modified Paths:
--------------
trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh11.tsv
trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh12.tsv
trunk/web2py/applications/helyesiras_webdev/modules/spell.py
Added Paths:
-----------
trunk/misc/spell/
trunk/misc/spell/cc_nevek.txt
trunk/misc/spell/gen_akh12_forms.py
Added: trunk/misc/spell/cc_nevek.txt
===================================================================
--- trunk/misc/spell/cc_nevek.txt (rev 0)
+++ trunk/misc/spell/cc_nevek.txt 2015-09-02 21:28:24 UTC (rev 1464)
@@ -0,0 +1,54 @@
+Benett e
+Brett e
+Emmett e
+Adrienn e
+Alett e
+Anett e
+Anriett e
+Antoanett e
+Antoniett e
+Arienn e
+Arlett e
+Babett e
+Bernadett e
+Ciprienn e
+Fadett e
+Henriett e
+Ivett e
+Ivonn a
+Kolett e
+Kozett e
+Linett e
+Lizbett e
+Lizett e
+Lorett e
+Mariann a
+Mariett e
+Miett e
+Nadett e
+Nanett e
+Nikolett e
+Ninett e
+Odett e
+Polett e
+Rominett e
+Ronett e
+Sarlott a
+Szimonett e
+Szkarlett e
+Szofinett e
+Violett e
+Zsanett e
+Zsinett e
+Zsorzsett e
+Zsüliett e
+Elzett e
+Hermann a
+Wittmann a
+Széll e
+Tarr a
+Bonn a
+Bükk e
+Talinn a
+Knorr a
+Blikk e
Added: trunk/misc/spell/gen_akh12_forms.py
===================================================================
--- trunk/misc/spell/gen_akh12_forms.py (rev 0)
+++ trunk/misc/spell/gen_akh12_forms.py 2015-09-02 21:28:24 UTC (rev 1464)
@@ -0,0 +1,38 @@
+# coding: utf8
+"""
+Generate AkH12 compatible positive and negative lists
+eg. Anett e=> *Anettel, Anett-tel
+output format: see spell_exceptions_akh12.tsv
+"""
+
+import sys
+
+SUFFS = [
+ ('nak','nek'),
+ ('ban','ben'),
+ ('ba','be'),
+ ('ból','ből'),
+ ('ról','ről'),
+ ('ra','re'),
+ ('nál','nél'),
+ ('tól','től'),
+ ('nak','nek'),
+ ('vá','vé'),
+ ('val','vel'),
+ ('hoz','hez')
+]
+
+with open(sys.argv[1]) as inp:
+ for line in inp:
+ cols = line.strip().split('\t')
+ if len(cols) != 2:
+ sys.stderr.write('Error: {}'.format(line))
+ continue
+ lemma, type = cols
+ for low, hi in SUFFS:
+ suff = low if type == 'a' else hi
+ if suff.startswith('v'):
+ suff = lemma[-1] + suff[1:]
+ if lemma[-1] == suff[0]:
+ print('{0}-{1}\t1'.format(lemma, suff))
+ print('{0}{1}\t0\t{0}-{2}'.format(lemma, suff[1:], suff))
\ No newline at end of file
Modified: trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh11.tsv
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh11.tsv 2015-09-02 18:52:19 UTC (rev 1463)
+++ trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh11.tsv 2015-09-02 21:28:24 UTC (rev 1464)
@@ -1,4 +1,4 @@
-# hack exception list for spell.py -- these will be used before any of the engines
+# Exception list for spell.py -- these will be used before any of the engines
# wordform TAB 1 (wf. is correct) or 0 (wf. is incorrect) TAB suggestion if incorrect (or empty if correct)
# lines starting with # are ignored
#szóalak 0: helytelen; 1: helyes javaslat, ha helytelen
Modified: trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh12.tsv
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh12.tsv 2015-09-02 18:52:19 UTC (rev 1463)
+++ trunk/web2py/applications/helyesiras_webdev/modules/resources/spell_exceptions_akh12.tsv 2015-09-02 21:28:24 UTC (rev 1464)
@@ -1,4 +1,4 @@
-# hack exception list for spell.py -- these will be used before any of the engines
+# Exception list for spell.py -- these will be used before any of the engines
# wordform TAB 1 (wf. is correct) or 0 (wf. is incorrect) TAB suggestion if incorrect (or empty if correct)
# lines starting with # are ignored
#szóalak 0: helytelen; 1: helyes javaslat, ha helytelen
@@ -145,4 +145,363 @@
véghezvisz 0 véghez visz
szóvégi 0 szó végi
vízbefúlás 0 vízbe fúlás
-zártkörű 0 zárt körű
\ No newline at end of file
+zártkörű 0 zárt körű
+# Frequent names ending with double consonants:
+Benett-től 1
+Benettől 0 Benett-től
+Benett-té 1
+Benetté 0 Benett-té
+Benett-tel 1
+Benettel 0 Benett-tel
+Brett-től 1
+Brettől 0 Brett-től
+Brett-té 1
+Bretté 0 Brett-té
+Brett-tel 1
+Brettel 0 Brett-tel
+Emmett-től 1
+Emmettől 0 Emmett-től
+Emmett-té 1
+Emmetté 0 Emmett-té
+Emmett-tel 1
+Emmettel 0 Emmett-tel
+Adrienn-nek 1
+Adriennek 0 Adrienn-nek
+Adrienn-nél 1
+Adriennél 0 Adrienn-nél
+Adrienn-nek 1
+Adriennek 0 Adrienn-nek
+Adrienn-né 1
+Adrienné 0 Adrienn-né
+Adrienn-nel 1
+Adriennel 0 Adrienn-nel
+Alett-től 1
+Alettől 0 Alett-től
+Alett-té 1
+Aletté 0 Alett-té
+Alett-tel 1
+Alettel 0 Alett-tel
+Anett-től 1
+Anettől 0 Anett-től
+Anett-té 1
+Anetté 0 Anett-té
+Anett-tel 1
+Anettel 0 Anett-tel
+Anriett-től 1
+Anriettől 0 Anriett-től
+Anriett-té 1
+Anrietté 0 Anriett-té
+Anriett-tel 1
+Anriettel 0 Anriett-tel
+Antoanett-től 1
+Antoanettől 0 Antoanett-től
+Antoanett-té 1
+Antoanetté 0 Antoanett-té
+Antoanett-tel 1
+Antoanettel 0 Antoanett-tel
+Antoniett-től 1
+Antoniettől 0 Antoniett-től
+Antoniett-té 1
+Antonietté 0 Antoniett-té
+Antoniett-tel 1
+Antoniettel 0 Antoniett-tel
+Arienn-nek 1
+Ariennek 0 Arienn-nek
+Arienn-nél 1
+Ariennél 0 Arienn-nél
+Arienn-nek 1
+Ariennek 0 Arienn-nek
+Arienn-né 1
+Arienné 0 Arienn-né
+Arienn-nel 1
+Ariennel 0 Arienn-nel
+Arlett-től 1
+Arlettől 0 Arlett-től
+Arlett-té 1
+Arletté 0 Arlett-té
+Arlett-tel 1
+Arlettel 0 Arlett-tel
+Babett-től 1
+Babettől 0 Babett-től
+Babett-té 1
+Babetté 0 Babett-té
+Babett-tel 1
+Babettel 0 Babett-tel
+Bernadett-től 1
+Bernadettől 0 Bernadett-től
+Bernadett-té 1
+Bernadetté 0 Bernadett-té
+Bernadett-tel 1
+Bernadettel 0 Bernadett-tel
+Ciprienn-nek 1
+Cipriennek 0 Ciprienn-nek
+Ciprienn-nél 1
+Cipriennél 0 Ciprienn-nél
+Ciprienn-nek 1
+Cipriennek 0 Ciprienn-nek
+Ciprienn-né 1
+Ciprienné 0 Ciprienn-né
+Ciprienn-nel 1
+Cipriennel 0 Ciprienn-nel
+Fadett-től 1
+Fadettől 0 Fadett-től
+Fadett-té 1
+Fadetté 0 Fadett-té
+Fadett-tel 1
+Fadettel 0 Fadett-tel
+Henriett-től 1
+Henriettől 0 Henriett-től
+Henriett-té 1
+Henrietté 0 Henriett-té
+Henriett-tel 1
+Henriettel 0 Henriett-tel
+Ivett-től 1
+Ivettől 0 Ivett-től
+Ivett-té 1
+Ivetté 0 Ivett-té
+Ivett-tel 1
+Ivettel 0 Ivett-tel
+Ivonn-nak 1
+Ivonnak 0 Ivonn-nak
+Ivonn-nál 1
+Ivonnál 0 Ivonn-nál
+Ivonn-nak 1
+Ivonnak 0 Ivonn-nak
+Ivonn-ná 1
+Ivonná 0 Ivonn-ná
+Ivonn-nal 1
+Ivonnal 0 Ivonn-nal
+Kolett-től 1
+Kolettől 0 Kolett-től
+Kolett-té 1
+Koletté 0 Kolett-té
+Kolett-tel 1
+Kolettel 0 Kolett-tel
+Kozett-től 1
+Kozettől 0 Kozett-től
+Kozett-té 1
+Kozetté 0 Kozett-té
+Kozett-tel 1
+Kozettel 0 Kozett-tel
+Linett-től 1
+Linettől 0 Linett-től
+Linett-té 1
+Linetté 0 Linett-té
+Linett-tel 1
+Linettel 0 Linett-tel
+Lizbett-től 1
+Lizbettől 0 Lizbett-től
+Lizbett-té 1
+Lizbetté 0 Lizbett-té
+Lizbett-tel 1
+Lizbettel 0 Lizbett-tel
+Lizett-től 1
+Lizettől 0 Lizett-től
+Lizett-té 1
+Lizetté 0 Lizett-té
+Lizett-tel 1
+Lizettel 0 Lizett-tel
+Lorett-től 1
+Lorettől 0 Lorett-től
+Lorett-té 1
+Loretté 0 Lorett-té
+Lorett-tel 1
+Lorettel 0 Lorett-tel
+Mariann-nak 1
+Mariannak 0 Mariann-nak
+Mariann-nál 1
+Mariannál 0 Mariann-nál
+Mariann-nak 1
+Mariannak 0 Mariann-nak
+Mariann-ná 1
+Marianná 0 Mariann-ná
+Mariann-nal 1
+Mariannal 0 Mariann-nal
+Mariett-től 1
+Mariettől 0 Mariett-től
+Mariett-té 1
+Marietté 0 Mariett-té
+Mariett-tel 1
+Mariettel 0 Mariett-tel
+Miett-től 1
+Miettől 0 Miett-től
+Miett-té 1
+Mietté 0 Miett-té
+Miett-tel 1
+Miettel 0 Miett-tel
+Nadett-től 1
+Nadettől 0 Nadett-től
+Nadett-té 1
+Nadetté 0 Nadett-té
+Nadett-tel 1
+Nadettel 0 Nadett-tel
+Nanett-től 1
+Nanettől 0 Nanett-től
+Nanett-té 1
+Nanetté 0 Nanett-té
+Nanett-tel 1
+Nanettel 0 Nanett-tel
+Nikolett-től 1
+Nikolettől 0 Nikolett-től
+Nikolett-té 1
+Nikoletté 0 Nikolett-té
+Nikolett-tel 1
+Nikolettel 0 Nikolett-tel
+Ninett-től 1
+Ninettől 0 Ninett-től
+Ninett-té 1
+Ninetté 0 Ninett-té
+Ninett-tel 1
+Ninettel 0 Ninett-tel
+Odett-től 1
+Odettől 0 Odett-től
+Odett-té 1
+Odetté 0 Odett-té
+Odett-tel 1
+Odettel 0 Odett-tel
+Polett-től 1
+Polettől 0 Polett-től
+Polett-té 1
+Poletté 0 Polett-té
+Polett-tel 1
+Polettel 0 Polett-tel
+Rominett-től 1
+Rominettől 0 Rominett-től
+Rominett-té 1
+Rominetté 0 Rominett-té
+Rominett-tel 1
+Rominettel 0 Rominett-tel
+Ronett-től 1
+Ronettől 0 Ronett-től
+Ronett-té 1
+Ronetté 0 Ronett-té
+Ronett-tel 1
+Ronettel 0 Ronett-tel
+Sarlott-tól 1
+Sarlottól 0 Sarlott-tól
+Sarlott-tá 1
+Sarlottá 0 Sarlott-tá
+Sarlott-tal 1
+Sarlottal 0 Sarlott-tal
+Szimonett-től 1
+Szimonettől 0 Szimonett-től
+Szimonett-té 1
+Szimonetté 0 Szimonett-té
+Szimonett-tel 1
+Szimonettel 0 Szimonett-tel
+Szkarlett-től 1
+Szkarlettől 0 Szkarlett-től
+Szkarlett-té 1
+Szkarletté 0 Szkarlett-té
+Szkarlett-tel 1
+Szkarlettel 0 Szkarlett-tel
+Szofinett-től 1
+Szofinettől 0 Szofinett-től
+Szofinett-té 1
+Szofinetté 0 Szofinett-té
+Szofinett-tel 1
+Szofinettel 0 Szofinett-tel
+Violett-től 1
+Violettől 0 Violett-től
+Violett-té 1
+Violetté 0 Violett-té
+Violett-tel 1
+Violettel 0 Violett-tel
+Zsanett-től 1
+Zsanettől 0 Zsanett-től
+Zsanett-té 1
+Zsanetté 0 Zsanett-té
+Zsanett-tel 1
+Zsanettel 0 Zsanett-tel
+Zsinett-től 1
+Zsinettől 0 Zsinett-től
+Zsinett-té 1
+Zsinetté 0 Zsinett-té
+Zsinett-tel 1
+Zsinettel 0 Zsinett-tel
+Zsorzsett-től 1
+Zsorzsettől 0 Zsorzsett-től
+Zsorzsett-té 1
+Zsorzsetté 0 Zsorzsett-té
+Zsorzsett-tel 1
+Zsorzsettel 0 Zsorzsett-tel
+Zsüliett-től 1
+Zsüliettől 0 Zsüliett-től
+Zsüliett-té 1
+Zsülietté 0 Zsüliett-té
+Zsüliett-tel 1
+Zsüliettel 0 Zsüliett-tel
+Elzett-től 1
+Elzettől 0 Elzett-től
+Elzett-té 1
+Elzetté 0 Elzett-té
+Elzett-tel 1
+Elzettel 0 Elzett-tel
+Hermann-nak 1
+Hermannak 0 Hermann-nak
+Hermann-nál 1
+Hermannál 0 Hermann-nál
+Hermann-nak 1
+Hermannak 0 Hermann-nak
+Hermann-ná 1
+Hermanná 0 Hermann-ná
+Hermann-nal 1
+Hermannal 0 Hermann-nal
+Wittmann-nak 1
+Wittmannak 0 Wittmann-nak
+Wittmann-nál 1
+Wittmannál 0 Wittmann-nál
+Wittmann-nak 1
+Wittmannak 0 Wittmann-nak
+Wittmann-ná 1
+Wittmanná 0 Wittmann-ná
+Wittmann-nal 1
+Wittmannal 0 Wittmann-nal
+Széll-lé 1
+Széllé 0 Széll-lé
+Széll-lel 1
+Széllel 0 Széll-lel
+Tarr-ról 1
+Tarról 0 Tarr-ról
+Tarr-ra 1
+Tarra 0 Tarr-ra
+Tarr-rá 1
+Tarrá 0 Tarr-rá
+Tarr-ral 1
+Tarral 0 Tarr-ral
+Bonn-nak 1
+Bonnak 0 Bonn-nak
+Bonn-nál 1
+Bonnál 0 Bonn-nál
+Bonn-nak 1
+Bonnak 0 Bonn-nak
+Bonn-ná 1
+Bonná 0 Bonn-ná
+Bonn-nal 1
+Bonnal 0 Bonn-nal
+Bükk-ké 1
+Bükké 0 Bükk-ké
+Bükk-kel 1
+Bükkel 0 Bükk-kel
+Talinn-nak 1
+Talinnak 0 Talinn-nak
+Talinn-nál 1
+Talinnál 0 Talinn-nál
+Talinn-nak 1
+Talinnak 0 Talinn-nak
+Talinn-ná 1
+Talinná 0 Talinn-ná
+Talinn-nal 1
+Talinnal 0 Talinn-nal
+Knorr-ról 1
+Knorról 0 Knorr-ról
+Knorr-ra 1
+Knorra 0 Knorr-ra
+Knorr-rá 1
+Knorrá 0 Knorr-rá
+Knorr-ral 1
+Knorral 0 Knorr-ral
+Blikk-ké 1
+Blikké 0 Blikk-ké
+Blikk-kel 1
+Blikkel 0 Blikk-kel
Modified: trunk/web2py/applications/helyesiras_webdev/modules/spell.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/modules/spell.py 2015-09-02 18:52:19 UTC (rev 1463)
+++ trunk/web2py/applications/helyesiras_webdev/modules/spell.py 2015-09-02 21:28:24 UTC (rev 1464)
@@ -131,10 +131,10 @@
[list_of_suggestions]: [] if token_is_correct==True, otherwise may be a list of suggested correct forms (Unicode strings), or [] if no suggestions available.
Returns [] if input was emtpy array or contained no meaningful tokens (e.g. only punctuation).
For each token:
- 0. preprocessing (kill commas etc.)
- 1. use hunspell (hsobj) to check if word form exists, get list of suggestions if not
- 2. use excdict to override false positives from hunspell
- 3. filter out nonsense suggestions, leave only TOPN suggestions
+ 1. preprocessing (kill commas etc.)
+ 2. use excdict to override hunspell, if applicable
+ 3. use hunspell (hsobj) to check if word form exists, get list of suggestions if not
+ 4. filter out nonsense suggestions, leave only TOPN suggestions
"""
ret = []
@@ -145,11 +145,10 @@
inp = [x.replace(':', ' ') for x in inp]
inp = [x.replace('_', ' ') for x in inp]
- #hunspout = call_hunspell_cmdline_ntok(inp)
# For each token:
for tok in inp:
- # check in false positives dictionary first
+ # check in exception dictionary first
exc = excdict.get(tok)
if exc is not None:
ret.append(exc) # overwrite with (known, suggs) from exception dict
@@ -202,8 +201,8 @@
return [(True, [])]
# N_sz + -szerű: észszerű correct only (*ésszerű)
+ # TODO
- # N_tt + -val/vel, -vá/vé, -tól/től: Bernadett-tel correct only (*Bernadettel)
# default
return inp
More information about the Hejes-devel
mailing list