This commit is contained in:
krangelov
2020-05-14 15:05:13 +02:00
3 changed files with 25 additions and 11 deletions

View File

@@ -32,6 +32,7 @@ The following people have contributed code to some of the versions:
- [Janna Khegai](http://www.cs.chalmers.se/~janna) (Chalmers) - [Janna Khegai](http://www.cs.chalmers.se/~janna) (Chalmers)
- [Peter Ljunglöf](http://www.cse.chalmers.se/~peb) (University of Gothenburg) - [Peter Ljunglöf](http://www.cse.chalmers.se/~peb) (University of Gothenburg)
- Petri Mäenpää (Nokia) - Petri Mäenpää (Nokia)
- Lauri Alanko (University of Helsinki)
At least the following colleagues are thanked for suggestions, bug At least the following colleagues are thanked for suggestions, bug
reports, and other indirect contributions to the code. reports, and other indirect contributions to the code.

View File

@@ -242,6 +242,10 @@ rmcomments :: String -> String
rmcomments [] = [] rmcomments [] = []
rmcomments ('-':'-':xs) = [] rmcomments ('-':'-':xs) = []
rmcomments ('-':x :xs) = '-':rmcomments (x:xs) rmcomments ('-':x :xs) = '-':rmcomments (x:xs)
rmcomments ('#':xs) = case splitAt 3 xs of -- for compatibility with gf-ud annotations
("cat",rest) -> rmcomments rest
("fun",rest) -> rmcomments rest
_ -> [] --- gf-ud keywords not used in gf-core
rmcomments (x:xs) = x:rmcomments xs rmcomments (x:xs) = x:rmcomments xs
-- | Prepare lines obtained from a configuration file for labels for -- | Prepare lines obtained from a configuration file for labels for
@@ -761,19 +765,21 @@ ppSVG svg =
-- UseComp {"not"} PART neg head -- UseComp {"not"} PART neg head
-- UseComp {*} AUX cop head -- UseComp {*} AUX cop head
type CncLabels = [ type CncLabels = [CncLabel]
Either
(String, String -> Maybe (String -> String,String,String)) data CncLabel =
-- (fun, word -> (pos,label,target)) CncSyncat (String, String -> Maybe (String -> String,String,String))
-- (fun, word/lemma -> (pos,label,target))
-- the pos can remain unchanged, as in the current notation in the article -- the pos can remain unchanged, as in the current notation in the article
(String,[String]) | CncMorpho (String,[String])
-- (category, morphological forms) -- (category, features in ascending order)
] | CncForm (String,(String,String))
-- (wordform, (lemma,features))
fixCoNLL :: CncLabels -> CoNLL -> CoNLL fixCoNLL :: CncLabels -> CoNLL -> CoNLL
fixCoNLL cncLabels conll = map (fixMorpho . fixDep) (markRoot conll) where fixCoNLL cncLabels conll = map (fixMorpho . fixDep) (markRoot conll) where
labels = [l | Left l <- cncLabels] labels = [l | CncSyncat l <- cncLabels]
flabels = [r | Right r <- cncLabels] flabels = [r | CncMorpho r <- cncLabels]
-- change the root label from dep to root -- change the root label from dep to root
--- doing this for the leftmost word of the root node --- doing this for the leftmost word of the root node
@@ -818,7 +824,7 @@ getCncDepLabels :: String -> CncLabels
getCncDepLabels s = wlabels ws ++ flabels fs getCncDepLabels s = wlabels ws ++ flabels fs
where where
wlabels = wlabels =
map Left . map CncSyncat .
map merge . map merge .
groupBy (\ (x,_) (a,_) -> x == a) . groupBy (\ (x,_) (a,_) -> x == a) .
sortBy (comparing fst) . sortBy (comparing fst) .
@@ -826,7 +832,7 @@ getCncDepLabels s = wlabels ws ++ flabels fs
filter chooseW filter chooseW
flabels = flabels =
map Right . map CncMorpho .
map collectTags . map collectTags .
map words map words

View File

@@ -3497,9 +3497,16 @@ MOD_INIT(pgf)
PyModule_AddObject(m, "Type", (PyObject *) &pgf_TypeType); PyModule_AddObject(m, "Type", (PyObject *) &pgf_TypeType);
Py_INCREF(&pgf_TypeType); Py_INCREF(&pgf_TypeType);
PyModule_AddObject(m, "PGF", (PyObject *) &pgf_PGFType);
Py_INCREF(&pgf_PGFType); Py_INCREF(&pgf_PGFType);
PyModule_AddObject(m, "Concr", (PyObject *) &pgf_ConcrType);
Py_INCREF(&pgf_ConcrType); Py_INCREF(&pgf_ConcrType);
PyModule_AddObject(m, "Iter", (PyObject *) &pgf_IterType);
Py_INCREF(&pgf_IterType); Py_INCREF(&pgf_IterType);
PyModule_AddObject(m, "Bracket", (PyObject *) &pgf_BracketType);
Py_INCREF(&pgf_BracketType); Py_INCREF(&pgf_BracketType);
return MOD_SUCCESS_VAL(m); return MOD_SUCCESS_VAL(m);