Skip to content

Commit

Permalink
Revised code to use flags for the morpheme boundaries that are distin…
Browse files Browse the repository at this point in the history
…ct from other flags, ruling out possible ambiguities, which appears to work.
  • Loading branch information
aarppe committed Mar 8, 2024
1 parent 6635fc4 commit a6e5022
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/fst/morphology/incoming/srs-bound-demo.xfscript
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,30 @@ read regex [Stems PostverbalAffixes] .o.
MarkPrefixes .o.
InsInner .o. InsMiddle .o. InsOuter .o.
LInnerPrefixAllomorphs .o. RequireOuterAllomorphs .o.
"." -> "." InnerAffixes "@P.PREFIX.INNER@" ,
"_" -> "_" MiddleAffixes "@P.PREFIX.MIDDLE@" ,
"=" -> "=" OuterAffixes "@P.PREFIX.OUTER@" ;
"." -> "." "@P.BOUND.INN-L@" InnerAffixes "@P.BOUND.INN-R@" ,
"_" -> "_" "@P.BOUND.MID-L@" MiddleAffixes "@P.BOUND.MID-R@" ,
"=" -> "=" "@P.BOUND.OUT-L@" OuterAffixes "@P.BOUND.OUT-R@" ;
define WordForms;

# Rewrite rule for resurrecting the prefix boundary markers

define ShowBoundaries [ "@P.PREFIX.INNER@" -> "." ,
"@P.PREFIX.MIDDLE@" -> "_" ,
"@P.PREFIX.OUTER@" -> "="
define ShowBoundaries [ "@P.BOUND.INN-L@" -> "(" ,
"@P.BOUND.MID-L@" -> "[" ,
"@P.BOUND.OUT-L@" -> "<" ,
"@P.BOUND.INN-R@" -> ")" ,
"@P.BOUND.MID-R@" -> "]" ,
"@P.BOUND.OUT-R@" -> ">"
];

define SimplifyBoundaries [ [ "=" "=" -> "=" , "_" "_" -> "_" , "." "." -> "." ]
.o. "=" "_" "." -> "="
.o. "_" "." -> "_"
.o. "=" "_" -> "="
.o. [ "=" | "_" | "." ] -> 0 || .#. _
];
# define SimplifyBoundaries [ [ "<" "<" -> "<" , ">" ">" -> ">" , "[" "[" -> "[" , "]" "]" -> "]" , "(" "(" -> "(" , ")" ")" -> ")" ]
# ];

# define SimplifyBoundaries [ [ "=" "=" -> "=" , "_" "_" -> "_" , "." "." -> "." ]
# .o. "=" "_" "." -> "="
# .o. "_" "." -> "_"
# .o. "=" "_" -> "="
# .o. [ "=" | "_" | "." ] -> 0 || .#. _
# ];

# Concatenate ObliqueAffixes and the other inflectional FSTs.
read regex WordForms .o. [..] -> ObliqueAffixes || .#. _;
Expand Down Expand Up @@ -144,11 +150,11 @@ set flag-is-epsilon OFF
# Output boundary markers based on flags

regex VerbModel .o. ShowBoundaries ;
define VerbModelWithBound
# define VerbModelWithBound

# Make flags invisible again, so that they will not intervene in removing excessive boundary markers
set flag-is-epsilon ON

regex VerbModelWithBound .o. SimplifyBoundaries ;
# regex VerbModelWithBound .o. SimplifyBoundaries ;

twosided flag-diacritics

0 comments on commit a6e5022

Please sign in to comment.