mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 08:58:55 -06:00
(Morphodict) Replace space/- in identifiers with _
This commit is contained in:
@@ -163,14 +163,18 @@ mkMorphoDict env =
|
|||||||
_ | length (nub (map tail fls)) == length fls -> shrinkMore (map tail fls)
|
_ | length (nub (map tail fls)) == length fls -> shrinkMore (map tail fls)
|
||||||
_ -> fls
|
_ -> fls
|
||||||
|
|
||||||
|
-- >>> mkFun ["hello", "world", "hello friends", "hello-all"]
|
||||||
mkFun = showCId . mkCId . concat . intersperse "_"
|
-- "hello_world_hello_friends_hello_all"
|
||||||
|
mkFun :: [String] -> String -- if word contains space or hyphen, replace with underscore
|
||||||
|
mkFun = showCId . mkCId . concat . intersperse "_" . concatMap (words . removeHyphen)
|
||||||
|
where
|
||||||
|
removeHyphen [] = []
|
||||||
|
removeHyphen ['-'] = ['-'] -- If hyphen is the last character, it's usually meaningful, leave it
|
||||||
|
removeHyphen ('-':cs) = ' ' : removeHyphen cs
|
||||||
|
removeHyphen (c:cs) = c : removeHyphen cs
|
||||||
|
|
||||||
quote s = "\"" ++ s ++ "\""
|
quote s = "\"" ++ s ++ "\""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{- ---- let us ignore this
|
{- ---- let us ignore this
|
||||||
findCompounds :: [RuleData] -> [RuleData]
|
findCompounds :: [RuleData] -> [RuleData]
|
||||||
findCompounds = getCompounds . sortOn cat_orthrevforms
|
findCompounds = getCompounds . sortOn cat_orthrevforms
|
||||||
|
|||||||
Reference in New Issue
Block a user