Daniel Janus
@nathell
| said cohabiting was no longer a | sin | . Serbs free last six |
| daily care of others was the ultimate | sin | . We arranged for Ted to spend a |
| remarkable. Shaw’s rendition was a | sin | against culture, an insult to Eliot |
| them that God wants them to turn from | sin | and transform their lives. Women |
| the ascendancy to and loss of power; | sin | and redemption; self-doubt and |
Source: ICT4LT
(def state (atom {}))
Map from corpora names to lists of files and indexes, wrapped in an atom
(defn-json-rpc frequency-list [corpus]
(sort-by second >
(into []
(map vec
(-> @state
(get corpus)
:index
:lemma-global-frequency)))))
(slightly simplified for clarity)
(defn-json-rpc add-corpus [name directory]
(let [files (filter (comp #{"html" "htm" "HTML" "HTM"}
extension)
(file-seq (file directory)))]
(do
(swap! state assoc name
{:directory directory
:num-files (count files)
:index (core/index-fileset files)})
(future (write-to config-file @state))
true)))
| ale “but” | 120 |
| ala “ancient Roman cavalry” | 120 |
play
plays
played
playing
| gra | gracie | graj | grajcie | grajcież | grajmy | grajmyż |
| grają | grając | grająca | grające | grającego | grającej | grającemu |
| grający | grających | grającym | grającymi | grającą | grajże | grali |
| graliby | gralibyście | gralibyśmy | graliście | graliśmy | gram | gramy |
| grana | grane | granego | granej | granemu | grani | grania |
| graniach | graniami | granie | graniem | graniom | graniu | grano |
| grany | granych | granym | granymi | graną | grasz | grał |
| grała | grałaby | grałabym | grałabyś | grałam | grałaś | grałby |
| grałbym | grałbyś | grałem | grałeś | grało | grałoby | grały |
| grałyby | grałybyście | grałybyśmy | grałyście | grałyśmy | grań | niegrająca |
| niegrające | niegrającego | niegrającej | niegrającemu | niegrający | niegrających | niegrającym |
| niegrającymi | niegrającą | niegrana | niegrane | niegranego | niegranej | niegranemu |
| niegrani | niegrania | niegraniach | niegraniami | niegranie | niegraniem | niegraniom |
| niegraniu | niegrany | niegranych | niegranym | niegranymi | niegraną | niegrań |
Over 3000 theoretically possible grammatical word descriptions,
over 1000 occurring in the wild
Positional tagsets
subst:sg:acc:m1
| subst | part of speech | noun |
| sg | number | singular |
| acc | case | accusative |
| m3 | gender | masculine inanimate |
More information: S. Acedański, A Morphosyntactic Brill Tagger for Inflectional Languages, in Advances in Natural Language Processing, 2010, pp. 3-14
((T[1]|pos,case = *,inst OR
T[2]|pos,case = *,inst OR
T[3]|pos,case = *,inst) AND
T[0]|pos,case = prep,gen) -> T[0]|case := inst
(def grammar
"S = COND ' -> ' ACTION
COND = SIMPLECOND | '(' COND ')' | COND ' OR ' COND | COND ' AND ' COND
SIMPLECOND = TAGPART ' = ' VALSPEC | SEGSPEC ENDSWITH WORDSPEC | SEGSPEC STARTSWITH WORDSPEC
WORDSPEC = '\\'' WORD '\\'' | 'capital letter'
SEGSPEC = TAG | 'nearby segment' | 'ORTH' | 'ORTH[' NUMBER ']'
TAG = 'T[' NUMBER ']'
TAGPART = TAG | TAG '|' TAGSPEC
ENDSWITH = ' ends ' ('(' NUMBER ' chars) ')? 'with '
STARTSWITH = ' starts with '
NUMBER = #'-?[0-9]+'
TAGSPEC = #'[a-z,]+'
VALSPEC = #'[a-z0-9,*:]+'
WORD = #'[-ąćęłńóśźża-z,.]+'
ACTION = TAGPART ' := ' VALSPEC")
(error checking omitted for clarity)
(defn rule-code
[{:keys [condition action], :as rule}]
`(fn [text# pos#]
(let [~'tag (fn [i#] (vget text# (+ i# pos#)))
~'current-seg (~'tag 0)]
(if ~(compile-condition condition)
~(compile-action action)
~'current-seg))))
(shortened for clarity)
(defn compile-condition [cnd]
(condp = (first cnd)
;; ... other conditions ...
:= (cond
(= (descend cnd 1 0) :tag)
(let [parsed-tag (tagset/parse-ctag (nth cnd 2))]
`(= (select-keys (~'tag ~(descend cnd 1 1))
~(vec (keys parsed-tag))) ~parsed-tag)))))
(defn compile-rule
[rule]
(eval (rule-code rule)))
Dziękuję | za | uwagę | ! |
| thank-I.singular.present | for | attention.singular.accusative | ! |
| dziękować:verb:fin:sg | za:qub | uwaga:subst:sg:acc | !:interp |
Daniel Janus