Skip to content

Instantly share code, notes, and snippets.

@shantanuo
Created October 30, 2018 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shantanuo/942219df1bc51fc97022da17a8ee8e0b to your computer and use it in GitHub Desktop.
Save shantanuo/942219df1bc51fc97022da17a8ee8e0b to your computer and use it in GitHub Desktop.
hunspell python package for reverse engineering of words
docker run -it -v /tmp/:/usr/src/myapp -w /usr/src/myapp python:3 bash
apt-get update
apt-get install python-dev
apt-get install libhunspell-dev
pip install hunspell
import hunspell
hobj = hunspell.HunSpell('mr_IN1.dic', 'mr_IN1.aff')
for x in hobj.stem('घोड्याचा'):
print (x.decode('utf-8'))
# cat mr_IN1.aff
SET UTF8
SFX च Y 4
SFX च डा ड्याचा डा
SFX च डा ड्याची डा
SFX च डा ड्याचे डा
SFX च डा ड्याच्या डा
# cat mr_IN1.dic
1
घोडा/च
@shantanuo
Copy link
Author

shantanuo commented Oct 31, 2018

!# cat mr_IN2.dic
1
घोडा/P

!# cat mr_IN2.aff
SET UTF8
SFX P Y 4
SFX P डा ड्याचा डा
SFX P डा ड्याची डा
SFX P डा ड्याचे डा
SFX P डा ड्याच्या डा

wget https://raw.githubusercontent.com/Shreeshrii/hindi-hunspell/master/tools/unmunch.sh

!# sh unmunch.sh mr_IN2.dic mr_IN2.aff | sort | uniq > mr-verbs.txt

!# cat hi-verbs.txt
घोडा
घोड्याचा
घोड्याची
घोड्याचे
घोड्याच्या

@shantanuo
Copy link
Author

cat mr_IN3.dic
1
बस/P

cat mr_IN3.aff

SFX P Y 5
SFX P 0 ण्या/QeZ .
SFX P 0 ल्या/QeZ .
SFX P 0 ल्यां/QaZ .
SFX P 0 लेल्या/QeZ .
SFX P 0 लेल्यां/QaZ .

SFX Q Y 4
SFX Q 0 साठी/Ze .
SFX Q 0 नंतर/Ze .
SFX Q 0 वर/Ze .
SFX Q 0 मागे/Ze .

SFX Z Y 2
SFX Z 0 च .
SFX Z 0 ही .

SFX e Y 9
SFX e 0 स/Z .
SFX e 0 ला/Z .
SFX e 0 ने/Z .
SFX e 0 शी/Z .
SFX e 0 हून/Z .
SFX e 0 चा/Z .
SFX e 0 ची/Z .
SFX e 0 चे/Z .
SFX e 0 त/Z .

SFX a Y 12
SFX a 0 स/Z .
SFX a 0 ला/Z .
SFX a 0 ना/Z .
SFX a 0 नी/Z .
SFX a 0 शी/Z .
SFX a 0 ही/Z .
SFX a 0 हून/Z .
SFX a 0 चा/Z .
SFX a 0 ची/Z .
SFX a 0 चे/Z .
SFX a 0 त/Z .
SFX a 0 नो/Z .

sh unmunch.sh mr_IN3.dic mr_IN3.aff | sort | uniq > mr-verbs.txt

cat mr-verbs.txt

बस
बसण्या
बसण्याच
बसण्याचा
बसण्याची
बसण्याचे
बसण्यात
बसण्यानंतर
बसण्याने
बसण्यामागे
बसण्याला
बसण्यावर
बसण्याशी
बसण्यास
बसण्यासाठी
बसण्याही
बसण्याहून
बसलेल्या
बसलेल्यां
बसलेल्यांच
बसलेल्यांचा
बसलेल्यांची
बसलेल्यांचे
बसलेल्यांत
बसलेल्यांनंतर
बसलेल्यांना
बसलेल्यांनी
बसलेल्यांनो
बसलेल्यांमागे
बसलेल्यांला
बसलेल्यांवर
बसलेल्यांशी
बसलेल्यांस
बसलेल्यांसाठी
बसलेल्यांही
बसलेल्यांहून
बसलेल्याच
बसलेल्याचा
बसलेल्याची
बसलेल्याचे
बसलेल्यात
बसलेल्यानंतर
बसलेल्याने
बसलेल्यामागे
बसलेल्याला
बसलेल्यावर
बसलेल्याशी
बसलेल्यास
बसलेल्यासाठी
बसलेल्याही
बसलेल्याहून
बसल्या
बसल्यां
बसल्यांच
बसल्यांचा
बसल्यांची
बसल्यांचे
बसल्यांत
बसल्यांनंतर
बसल्यांना
बसल्यांनी
बसल्यांनो
बसल्यांमागे
बसल्यांला
बसल्यांवर
बसल्यांशी
बसल्यांस
बसल्यांसाठी
बसल्यांही
बसल्यांहून
बसल्याच
बसल्याचा
बसल्याची
बसल्याचे
बसल्यात
बसल्यानंतर
बसल्याने
बसल्यामागे
बसल्याला
बसल्यावर
बसल्याशी
बसल्यास
बसल्यासाठी
बसल्याही
बसल्याहून

@shantanuo
Copy link
Author

!apt-get update && apt-get install -y zip wget

!wget https://extensions.libreoffice.org/extensions/marathi-spellchecker/1.6/@@download/file/lib_with_syn_suffix_v1.oxt

!unzip lib_with_syn_suffix_v1.oxt

!grep ' ीं' dicts/mr_IN.dic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment