Skip to content

davidpgero/hungarian-nltk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hungarian NLTK

Examples of Hungarian Sentence Analysis with NLTK ~> 3.2.1

Gerő Dávid Péter (2014) Egyszerű magyar mondatok kezelése NLTK környezetben. Hungarian sentence analysis in NLTK, BA/BSc, Szegedi Tudományegyetem. [http://diploma.bibl.u-szeged.hu/51272/]

Install

Prerequisite

  • I recommend to use Anaconda
  • Python ~> 3.5 (It includes in Anaconda 3)

Install with Conda

conda build .

Install without Anaconda

easy_install install nltk

Examples

AB grammar

AB grammar

Context free grammar

Peter and Mari

FCFG

FCFG

Regexp stemmer

Word Stem
Péter Péter
szereti szeret
Enikőt Enikő
és és
Marit Mari

Snowball stemmer

Word Stem
Péter péter
szereti szeret
Enikőt enikő
és és
Marit mar

Unigramm Tagger

$ python examples/unigramm_tagger.py
[('Péter', 'N'), ('Enikő', 'N'), ('szeret', 'V'), ('Marit', 'Nacc')]

Word tokenizer

$ python examples/word_tokenizer.py
Szeretnék
kérni
tőled
egy
óriási
szívességet
.

Semantic

A True sentence: Egy asztal poros ~> a table is dusty

The sentence: 'egy asztal poros'
The parsed tree: '(S[SEM=<exists x.(-alive(x) & -agent(x))>]
  (NP[SEM=<\P.exists x.(-alive(x) & P(x))>]
    (Det[SEM=<\Q P.exists x.(Q(x) & P(x))>] egy)
    (N[SEM=<\x.-alive(x)>] asztal))
  (VP[SEM=<\x.-agent(x)>] (V[SEM=<\x.-agent(x)>] poros)))'
The semantic formula: 'exists x.(-alive(x) & -agent(x))'
The semantic value: 'True'

A False sentence: egy asztal fut ~> a table runs

The sentence: 'egy asztal fut'
The parsed tree: '(S[SEM=<exists x.(-alive(x) & agent(x))>]
  (NP[SEM=<\P.exists x.(-alive(x) & P(x))>]
    (Det[SEM=<\Q P.exists x.(Q(x) & P(x))>] egy)
    (N[SEM=<\x.-alive(x)>] asztal))
  (VP[SEM=<\x.agent(x)>] (V[SEM=<\x.agent(x)>] fut)))'
The semantic formula: 'exists x.(-alive(x) & agent(x))'
The semantic value: 'False'