Skip to content

Commit

Permalink
fixing COERROR by upgrading to newest standard
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnda-hill committed Sep 16, 2024
1 parent 673cd6a commit b12e6c8
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions tools/grammarcheckers/grammarchecker.cg3
Original file line number Diff line number Diff line change
Expand Up @@ -4338,7 +4338,7 @@ ADD:xmsyn-numphrase-sgill (&msyn-numphrase-sgill) TARGET (Num Sg Nom) OR (Num Sg
(NEGATE *1 (N Sg Ill) BARRIER NOT-NPMOD LINK *1 Po BARRIER (*) - CC - Gen - (N Pl Nom))
(NEGATE *1 (N <spelled>) BARRIER NOT-NPMOD) ;

ADD:num-phrase (COERROR) TARGET (Num &msyn-numphrase-sgill) IF (*1 (&msyn-numphrase-sgill) BARRIER NOT-Attr - PrfPrc);
ADD:num-phrase (co&msyn-numphrase-sgill) TARGET (Num &msyn-numphrase-sgill) IF (*1 (&msyn-numphrase-sgill) BARRIER NOT-Attr - PrfPrc);

ADDRELATION ($2 LEFT) (N &msyn-numphrase-sgill) OR NUMUNIT + &msyn-numphrase-sgill TO (*-1 (Num &msyn-numphrase-sgill) OR ("moadda" Indef &msyn-numphrase-sgill) BARRIER NOT-Attr - PrfPrc) ;

Expand Down Expand Up @@ -5244,71 +5244,70 @@ ADD:punct-aistton-right (&punct-aistton-right) TARGET ("'" PUNCT) OR ("\"" PUNCT
## Doppe biddjui ovdan nu ahte sápmelaččaide mearkkaša dát: «leat dahje ii leat{»}.

# 2. Add COERROR tags to the preceding/following word (depending on LEFT or RIGHT quotation marks), to handle overlapping errors:
MAP:punct-aistton-both-link (&punct-aistton-both COERROR ) TARGET (*) IF (-2 (&punct-aistton-both) LINK NOT 0 (COERROR)) ;
ADD:punct-aistton-left-link (&punct-aistton-left COERROR ) TARGET (*) IF (-1 (&punct-aistton-left) LINK NOT 0 (COERROR)) ;
#ADD:punct-aistton-left-link (&punct-aistton-left COERROR ) TARGET (*) IF (-*<1 (>>>) BARRIER (>>>) (&punct-aistton-left) LINK NOT 0 (COERROR)) ;
MAP:punct-aistton-both-link (co&punct-aistton-both ) TARGET (*) IF (-2 (&punct-aistton-both) LINK NOT 0 (co&punct-aistton-both)) ;
ADD:punct-aistton-left-link (co&punct-aistton-left ) TARGET (*) IF (-1 (&punct-aistton-left) LINK NOT 0 (co&punct-aistton-left)) ;
#ADD:punct-aistton-left-link (co&punct-aistton-left ) TARGET (*) IF (-*<1 (>>>) BARRIER (>>>) (&punct-aistton-left) LINK NOT 0 (co&punct-aistton-left)) ;
# when it follows the next window

ADD:punct-aistton-right-link (&punct-aistton-right COERROR ) TARGET (*) IF (1 (&punct-aistton-right) LINK NOT 0 (COERROR)) ;
ADD:punct-aistton-right-link (co&punct-aistton-right ) TARGET (*) IF (1 (&punct-aistton-right) LINK NOT 0 (co&punct-aistton-right)) ;

ADD:punct-aistton-right-link (&punct-aistton-right COERROR) TARGET ("." CLB) OR ("!" CLB) OR ("?" CLB) IF (1*> (>>>) BARRIER (>>>) LINK 1 ("'" PUNCT <SpaceOnRightSide>) OR ("\"" PUNCT <SpaceOnRightSide>) OR (""" PUNCT <SpaceOnRightSide>) OR ("»" PUNCT <SpaceOnRightSide>) LINK NOT 0 (COERROR)) ;
ADD:punct-aistton-right-link (co&punct-aistton-right) TARGET ("." CLB) OR ("!" CLB) OR ("?" CLB) IF (1*> (>>>) BARRIER (>>>) LINK 1 ("'" PUNCT <SpaceOnRightSide>) OR ("\"" PUNCT <SpaceOnRightSide>) OR (""" PUNCT <SpaceOnRightSide>) OR ("»" PUNCT <SpaceOnRightSide>) LINK NOT 0 (COERROR)) ;
# when jumping to the next window

# 3. Add relation RIGHT/LEFT from the sentral cohort to the LINKed cohort for extended underline:
ADDRELATION:punct-aistton-both-rel (RIGHT) (&punct-aistton-both) TO (2 COERROR LINK 0 (&punct-aistton-both) );
ADDRELATION:punct-aistton-left-rel (RIGHT) (&punct-aistton-left) TO (1 COERROR LINK 0 (&punct-aistton-left) );
ADDRELATION:punct-aistton-left-rel (RIGHT) (&punct-aistton-left) TO (1*> (>>>) BARRIER (>>>) LINK 1 COERROR LINK 0 (&punct-aistton-left) );
ADDRELATION:punct-aistton-both-rel (RIGHT) (&punct-aistton-both) TO (2 (co&punct-aistton-both) );
ADDRELATION:punct-aistton-left-rel (RIGHT) (&punct-aistton-left) TO (1 (co&punct-aistton-left) );
ADDRELATION:punct-aistton-left-rel (RIGHT) (&punct-aistton-left) TO (1*> (>>>) BARRIER (>>>) LINK 1 (co&punct-aistton-left) );
## Jos boađát dakko, go boađát stálu goahtái, de mon galggan neavvut du.{"} Sápmelaš vulggii ruoktot.
ADDRELATION:punct-aistton-right-rel (LEFT) (&punct-aistton-right) TO (-1 COERROR LINK 0 (&punct-aistton-right));
ADDRELATION:punct-aistton-right-rel (LEFT) (&punct-aistton-right) TO (-1*< (<<<) BARRIER (<<<) LINK 0 COERROR LINK 0 (&punct-aistton-right));
ADDRELATION:punct-aistton-right-rel (LEFT) (&punct-aistton-right) TO (-1 (co&punct-aistton-right));
ADDRELATION:punct-aistton-right-rel (LEFT) (&punct-aistton-right) TO (-1*< (<<<) BARRIER (<<<) LINK 0 (co&punct-aistton-right));

# 4. Generate suggestions including the following/preceeding word (ie matching underline):
# Generer forslag for hermeteikn på _begge_ sider viss me har feilen på eitt og same ord:
COPY:punct-aistton-both-sugg KEEPORDER (VSTR:"”$1”"S SUGGESTWF) TARGET (&punct-aistton-both) IF
(NOT 0 (COERROR))
(2 &punct-aistton-both)
(2 COERROR)
(NOT 0 (co&punct-aistton-both))
(2 (co&punct-aistton-both))
(1 ("<(.*)>"r))
(NOT 0 SUGGESTWF) # don't COPY more than once
;

# Generer forslag for doble hermeteikn på _venstre_ side:
COPY:punct-aistton-left-sugg KEEPORDER (VSTR:"”$1"S SUGGESTWF) TARGET (&punct-aistton-left) IF
(NOT 0 (COERROR))
(NOT 0 (co&punct-aistton-left))
(NOT 0 ("'" PUNCT) OR ("‚") OR ("‛") OR ("❛") OR ("‘"))
(1 &punct-aistton-left LINK 0 COERROR LINK 0 ("<(.*)>"r))
(1 (co&punct-aistton-left) LINK 0 ("<(.*)>"r))
(NOT 0 SUGGESTWF) # don't COPY more than once
;

# Generer forslag for enkle hermeteikn på _venstre_ side:
COPY:punct-aistton-left-sugg KEEPORDER (VSTR:"’$1"S SUGGESTWF) TARGET (&punct-aistton-left) IF
(0 ("'" PUNCT) OR ("‚") OR ("‛") OR ("❛") OR ("‘"))
(NOT 0 (COERROR))
(1 &punct-aistton-left LINK 0 COERROR LINK 0 ("<(.*)>"r))
(NOT 0 (co&punct-aistton-left))
(1 (co&punct-aistton-left) LINK 0 ("<(.*)>"r))
(NOT 0 SUGGESTWF) # don't COPY more than once
;

# Generer forslag for hermeteikn på _høgre_ side:
COPY:punct-aistton-right-sugg KEEPORDER (VSTR:"$1”"S SUGGESTWF) TARGET (&punct-aistton-right) IF
(NOT 0 (COERROR))
(NOT 0 (co&punct-aistton-right))
(NOT 0 ("'" PUNCT))
(-1 &punct-aistton-right LINK 0 COERROR LINK 0 ("<(.*)>"r))
(-1 (co&punct-aistton-right) LINK 0 ("<(.*)>"r))
(NOT 0 SUGGESTWF) # don't COPY more than once
;
# this one is after a clause/window boundary
COPY:punct-aistton-right-sugg KEEPORDER (VSTR:"$1”"S SUGGESTWF) TARGET (&punct-aistton-right) IF
(NOT 0 (COERROR))
(NOT 0 (co&punct-aistton-right))
(NOT 0 ("'" PUNCT))
(-1*< (<<<) BARRIER (<<<) LINK 0 &punct-aistton-right LINK 0 COERROR LINK 0 ("<(.*)>"r))
(-1*< (<<<) BARRIER (<<<) LINK 0 (co&punct-aistton-right) LINK 0 ("<(.*)>"r))
(NOT 0 SUGGESTWF) # don't COPY more than once
;
## Jos boađát dakko, go boađát stálu goahtái, de mon galggan neavvut du{."} Sápmelaš vulggii ruoktot.

# Generer forslag for hermeteikn på _høgre_ side:
COPY:punct-aistton-right-sugg KEEPORDER (VSTR:"$1’"S SUGGESTWF) TARGET (&punct-aistton-right) IF
(NOT 0 (COERROR))
(NOT 0 (co&punct-aistton-right))
(0 ("'" PUNCT))
(-1 &punct-aistton-right LINK 0 COERROR LINK 0 ("<(.*)>"r))
(-1 (co&punct-aistton-right) LINK 0 ("<(.*)>"r))
(NOT 0 SUGGESTWF) # don't COPY more than once
;

Expand Down Expand Up @@ -5365,40 +5364,40 @@ SUBSTITUTE:RemoveNoSpaceAfterPunctMark (<NoSpaceAfterPunctMark>) (*) TARGET ("?"
# -----------------------------------------------------

ADD:space-after-paren-beg (&space-after-paren-beg) TARGET (<spaceAfterParenBeg>) ;
ADD:space-after-paren-beg-link (&space-after-paren-beg COERROR) TARGET (*) IF (-1 (<spaceAfterParenBeg>) ) ;
ADDRELATION:space-after-paren-beg-rel (RIGHT) (&space-after-paren-beg) TO (1 (COERROR) LINK 0 (&space-after-paren-beg)) ;
ADD:space-after-paren-beg-link (co&space-after-paren-beg) TARGET (*) IF (-1 (<spaceAfterParenBeg>) ) ;
ADDRELATION:space-after-paren-beg-rel (RIGHT) (&space-after-paren-beg) TO (1 (co&space-after-paren-beg)) ;
COPY:space-after-paren-beg-sugg (VSTR:"$1$2"S SUGGESTWF) TARGET ("<(.*)>"r &space-after-paren-beg) IF
(1 ("<(.*)>"r))
(NOT 0 (COERROR))
(NOT 0 (co&space-after-paren-beg))
(NOT 0 SUGGESTWF) # don't COPY more than once
;
## áddejumi )

ADD:space-before-paren-end (&space-before-paren-end) TARGET (<spaceBeforeParenEnd>);
ADD:space-before-paren-end-link (&space-before-paren-end COERROR) TARGET (*) IF (1 (<spaceBeforeParenEnd>) );
ADDRELATION:space-before-paren-end-rel (LEFT) (&space-before-paren-end) TO (-1 (COERROR) LINK 0 (&space-before-paren-end) );
ADD:space-before-paren-end-link (co&space-before-paren-end) TARGET (*) IF (1 (<spaceBeforeParenEnd>) );
ADDRELATION:space-before-paren-end-rel (LEFT) (&space-before-paren-end) TO (-1 (co&space-before-paren-end));
COPY:space-before-paren-end-sugg (VSTR:"$2$1"S SUGGESTWF) TARGET ("<(.*)>"r &space-before-paren-end) IF
(-1 ("<(.*)>"r))
(NOT 0 (COERROR))
(NOT 0 (co&space-before-paren-end))
(NOT 0 SUGGESTWF) # don't COPY more than once
;
## Son gii njeaidá skáluid šaddá eret vuolgit . De galgá fas cegget skáluid ja álgit gaikut.

ADD:space-before-punct-mark (&space-before-punct-mark) TARGET (<SpaceBeforePunctMark>)(NEGATE -1 <SpaceOnRightSide>);
#$ Paltto (s. 37) «mánát sturrot/mun ieš boarásmuvan» {?}?
ADD:space-before-punct-mark-link (&space-before-punct-mark COERROR) TARGET (*) IF (1 (<SpaceBeforePunctMark>) );
ADDRELATION:space-before-punct-mark-rel (LEFT) (&space-before-punct-mark) TO (-1 (COERROR) LINK 0 (&space-before-punct-mark) );
ADD:space-before-punct-mark-link (co&space-before-punct-mark) TARGET (*) IF (1 (<SpaceBeforePunctMark>) );
ADDRELATION:space-before-punct-mark-rel (LEFT) (&space-before-punct-mark) TO (-1 (co&space-before-punct-mark));
COPY:space-before-punct-mark-sugg (VSTR:"$2$1"S SUGGESTWF) TARGET ("<(.*)>"r &space-before-punct-mark) IF
(-1 ("<(.*)>"r))
(NOT 0 (COERROR))
(NOT 0 (co&space-before-punct-mark))
(NOT 0 (SUGGESTWF)) # don't COPY more than once
;
## vuosttu ceggejit
## álgit gaikut. Stoagus joatká
## maid lea bargu. – Mun barggan

ADD:double-space-before (&double-space-before) (<doubleSpaceBefore>);
ADD:double-space-before-link (&double-space-before COERROR) TARGET (*) IF (T:nextWordCrossSent LINK 0 (<doubleSpaceBefore>)) ;
ADD:double-space-before-link (co&double-space-before) TARGET (*) IF (T:nextWordCrossSent LINK 0 (<doubleSpaceBefore>)) ;
ADDRELATION:double-space-before-rel ($2) (*) FROM (T:nextWordCrossSent LINK 0 (<doubleSpaceBefore>)) ;
ADDRELATION:double-space-before-rel (LEFT) (COERROR) FROM (T:nextWordCrossSent LINK 0 (<doubleSpaceBefore>)) ;
COPY:double-space-before (VSTR:"$2\ $1"S SUGGESTWF) TARGET ("<(.*)>"r &double-space-before) IF
Expand Down

0 comments on commit b12e6c8

Please sign in to comment.