diff options
| author | hallgren <hallgren@chalmers.se> | 2015-01-21 10:41:12 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2015-01-21 10:41:12 +0000 |
| commit | ffe1f7458444e5b3df738877dfec812ff827d930 (patch) | |
| tree | 60dedbe1668265b65153663596aacc643090e4d5 /src/runtime/haskell-bind | |
| parent | 790738c82b88ace2bba8f442adb8ba0c30ae2c27 (diff) | |
PGF2 & PGFService: enable callbacks for named entities and chunks in the c-parse & c-translate web requests
Diffstat (limited to 'src/runtime/haskell-bind')
| -rw-r--r-- | src/runtime/haskell-bind/PGF2.hsc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index 39a8b29f1..34427f9a5 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -515,7 +515,7 @@ nerc pgf (lang,concr) lin_idx sentence offset = expr = mkApp "SymbPN" [mkApp "MkSymb" [mkStr name]] end_offset = length sentence-length rest name = trimRight (concat capwords) - ls = [((l,getFunctionType pgf l),p)|(l,_,p)<-lookupMorpho concr name] + ls = [((l,functionCat l),p)|(l,_,p)<-lookupMorpho concr name] ((lemma,cat),_) = maximumBy (compare `on` snd) ls _ -> Nothing where @@ -526,8 +526,7 @@ nerc pgf (lang,concr) lin_idx sentence offset = Just (y,xs') -> (y:ys,xs'') where (ys,xs'') = consume munch xs' - getFunctionType :: PGF -> String -> Cat - getFunctionType = undefined + functionCat f = case functionType pgf f of DTyp _ cat _ -> cat -- | Callback to parse arbitrary words as chunks (from -- ../java/org/grammaticalframework/pgf/UnknownLiteralCallback.java) @@ -540,6 +539,9 @@ chunk _ (_,concr) lin_idx sentence offset = expr = mkApp "MkSymb" [mkStr (trimRight word)] _ -> Nothing + +-- More helper functions + trimRight = reverse . dropWhile isSpace . reverse capitalized = capitalized' isUpper |
