summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2015-01-21 13:54:48 +0000
committerhallgren <hallgren@chalmers.se>2015-01-21 13:54:48 +0000
commit6b55ad88d4440ff6e68445006f625249637053b8 (patch)
treebcc254cd22e9125ec5eb0683cc8e787e157b7957 /src/runtime/haskell-bind
parent6ddef21dea38a249cd0645f78bf6ef0986f0b0a3 (diff)
PGF2: fixes for named entity callback function
Diffstat (limited to 'src/runtime/haskell-bind')
-rw-r--r--src/runtime/haskell-bind/PGF2.hsc18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc
index 34427f9a5..20ffc11c4 100644
--- a/src/runtime/haskell-bind/PGF2.hsc
+++ b/src/runtime/haskell-bind/PGF2.hsc
@@ -44,6 +44,7 @@ import Data.IORef
import Data.Char(isUpper,isSpace)
import Data.List(isSuffixOf,maximumBy)
import Data.Function(on)
+--import Debug.Trace
type CId = String
@@ -146,10 +147,12 @@ unloadConcr c = pgf_concrete_unload (concr c)
data Type =
DTyp [Hypo] CId [Expr]
+ deriving Show
data BindType =
Explicit
| Implicit
+ deriving Show
-- | 'Hypo' represents a hypothesis in a type i.e. in the type A -> B, A is the hypothesis
type Hypo = (BindType,CId,Type)
@@ -510,13 +513,16 @@ nerc pgf (lang,concr) lin_idx sentence offset =
"Language" -> Nothing
_ -> pn
where
- retLit e = Just (expr,0,end_offset)
- pn = retLit expr
- expr = mkApp "SymbPN" [mkApp "MkSymb" [mkStr name]]
- end_offset = length sentence-length rest
+ retLit e = --traceShow (name,e,drop end_offset sentence) $
+ Just (e,0,end_offset)
+ where end_offset = length sentence-length rest
+ pn = retLit (mkApp "SymbPN" [mkApp "MkSymb" [mkStr name]])
+ ((lemma,cat),_) = maximumBy (compare `on` snd) (reverse ls)
+ ls = [((fun,cat),p)
+ |(fun,_,p)<-lookupMorpho concr name,
+ let cat=functionCat fun,
+ cat/="Nationality"]
name = trimRight (concat capwords)
- ls = [((l,functionCat l),p)|(l,_,p)<-lookupMorpho concr name]
- ((lemma,cat),_) = maximumBy (compare `on` snd) ls
_ -> Nothing
where
-- | Variant of unfoldr