1
0
forked from GitHub/gf-rgl

(Fin) Allow punctuation after abbreviations

This commit is contained in:
Inari Listenmaa
2022-10-21 10:43:42 +02:00
parent 96f4543c4c
commit 54d4a762d6

View File

@@ -288,8 +288,18 @@ resource MorphoFin = ResFin ** open Prelude in {
(jalaksi + "n" + a) (jalaksi + "ss" + a) (jalaksi + "in") ; (jalaksi + "n" + a) (jalaksi + "ss" + a) (jalaksi + "in") ;
dSDP : Str -> NForms = \SDP -> dSDP : Str -> NForms = \SDP ->
let let c : Str*Str*Str*Str*Str*Str*Str*Str*Str = case SDP of {
c = case Predef.toUpper (last SDP) of { _ + P@? + (")"|"]"|"!"|"?"|"-") -- ignore punctuation after vowel, e.g. Poly(A):n
=> getCases P SDP ;
_ + P@? => getCases P SDP } ;
in nForms10
SDP (SDP + ":" + c.p1) (SDP + ":" + c.p2) (SDP + ":" + c.p3)
(SDP + ":" + c.p4) (SDP + ":" + c.p5) (SDP + ":" + c.p6)
(SDP + ":" + c.p7) (SDP + ":" + c.p8) (SDP + ":" + c.p9) ;
-- Helper function for dSDP
getCases : Str -> Str -> Str*Str*Str*Str*Str*Str*Str*Str*Str ;
getCases c errorMsg = case Predef.toUpper c of {
"A" => "A" =>
<"n","ta","na","han","iden","ita","ina","issa","ihin"> ; <"n","ta","na","han","iden","ita","ina","issa","ihin"> ;
"B" | "C" | "D" | "E" | "G" | "P" | "T" | "V" | "W" => "B" | "C" | "D" | "E" | "G" | "P" | "T" | "V" | "W" =>
@@ -310,12 +320,8 @@ resource MorphoFin = ResFin ** open Prelude in {
<"n","tä","nä","hön","iden","itä","inä","issä","ihin"> ; <"n","tä","nä","hön","iden","itä","inä","issä","ihin"> ;
"Y" => "Y" =>
<"n","tä","nä","hyn","iden","itä","inä","issä","ihin"> ; <"n","tä","nä","hyn","iden","itä","inä","issä","ihin"> ;
_ => Predef.error (["illegal abbreviation"] ++ SDP) _ => Predef.error (["illegal abbreviation"] ++ errorMsg) } ;
} ;
in nForms10
SDP (SDP + ":" + c.p1) (SDP + ":" + c.p2) (SDP + ":" + c.p3)
(SDP + ":" + c.p4) (SDP + ":" + c.p5) (SDP + ":" + c.p6)
(SDP + ":" + c.p7) (SDP + ":" + c.p8) (SDP + ":" + c.p9) ;
-- for adjective comparison -- for adjective comparison