copied examples/app to examples/slowApp; the new app is a bit scaled down but much faster

This commit is contained in:
aarne
2015-06-02 12:59:29 +00:00
parent d723babc2c
commit 2529f87942
44 changed files with 66045 additions and 31 deletions
+37
View File
@@ -0,0 +1,37 @@
abstract App =
Translate - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,Phrasebook
** {
flags
startcat=Phr ;
heuristic_search_factor=0.80; -- doesn't seem to affect speed or quality much
fun
PhrasePhr : Phrase -> Phr ;
Phrase_Chunk : Phrase -> Chunk ;
ComplV2V : V2V -> NP -> VP -> VP ;
ComplV2A : V2A -> NP -> AP -> VP ;
ComplV2Q : V2Q -> NP -> QS -> VP ;
ComplV2S : V2S -> NP -> S -> VP ;
ComplV3 : V3 -> NP -> NP -> VP ;
}
+47
View File
@@ -0,0 +1,47 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppBul of App =
TranslateBul - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookBul - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
** open ParadigmsBul, SyntaxBul, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+47
View File
@@ -0,0 +1,47 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppCat of App =
TranslateCat - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookCat - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, cheap_A,expensive_A, open_A, closed_A]
** open ParadigmsCat, SyntaxCat, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+48
View File
@@ -0,0 +1,48 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppChi of App =
TranslateChi - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookChi - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A, at_Prep, by_Prep]
** open ParadigmsChi, SyntaxChi, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+46
View File
@@ -0,0 +1,46 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppDut of App =
TranslateDut - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookDut - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
** open ParadigmsDut, SyntaxDut, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+45
View File
@@ -0,0 +1,45 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppEng of App =
TranslateEng - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookEng - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv]
** open MorphoEng, ResEng, ParadigmsEng, SyntaxEng, (G = GrammarEng), (E = ExtraEng), Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+46
View File
@@ -0,0 +1,46 @@
--# -path=.:../../lib/src/chunk:../../lib/src/finnish/stemmed:../../lib/src/finnish:../../lib/src/api:../../lib/src/translator:../phrasebook/gfos:alltenses
concrete AppFin of App =
TranslateFin - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookFin - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_A, open_Adv]
** open ParadigmsFin, SyntaxFin, Prelude in {
flags
literal=Symb ;
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+47
View File
@@ -0,0 +1,47 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppFre of App =
TranslateFre - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookFre - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_A, closed_A]
** open ParadigmsFre, SyntaxFre, Prelude in {
flags
literal=Symb ;
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+68
View File
@@ -0,0 +1,68 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppFreInput of App =
{-
TranslateFre - [
---- SlashVP, SlashVS, ---- expensive functions in Fre
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
-}
NounFre - [PPartNP],
AdjectiveFre,
VerbFre [UseV,CompAP,CompAdv,UseComp,AdvVP,SlashV2a,ComplSlash],
SentenceFre [PredVP,UseCl],
QuestionFre - [QuestCl,QuestIAdv,ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP],
ConjunctionFre,
ConstructionFre,
TranslateFre [QuestCl,QuestIAdv],
IdiomFre - [CleftNP, CleftAdv,ImpP3],
TenseFre,
PhraseFre,
AdverbFre,
NumeralFre,
DocumentationFre,
SymbolFre [
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
],
DictionaryFre,
ChunkFre
,PhrasebookFre - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_A, closed_A]
** open ParadigmsFre, SyntaxFre, Prelude in {
flags
literal=Symb ;
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
{-
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
-}
}
+46
View File
@@ -0,0 +1,46 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos:alltenses::../../lib/src/german
concrete AppGer of App =
TranslateGer - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookGer - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
** open ParadigmsGer, SyntaxGer, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+46
View File
@@ -0,0 +1,46 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppHin of App =
TranslateHin - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookHin - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
** open ParadigmsHin, SyntaxHin, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+45
View File
@@ -0,0 +1,45 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppIta of App =
TranslateIta - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookIta - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_A, closed_A]
** open ParadigmsIta, SyntaxIta, Prelude in {
flags
literal=Symb ;
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+48
View File
@@ -0,0 +1,48 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppJpn of App =
TranslateJpn - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookJpn ---- - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A, at_Prep, by_Prep]
** open ParadigmsJpn, SyntaxJpn, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
---- PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
---- PGreetingMale, PGreetingFemale = \s -> lin Text s ;
---- GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+47
View File
@@ -0,0 +1,47 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppSpa of App =
TranslateSpa - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookSpa - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, cheap_A,expensive_A, open_A, closed_A]
** open ParadigmsSpa, SyntaxSpa, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+45
View File
@@ -0,0 +1,45 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppSwe of App =
TranslateSwe - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookSwe - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
** open MorphoSwe, ResSwe, ParadigmsSwe, SyntaxSwe, CommonScand, (E = ExtraSwe), Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+48
View File
@@ -0,0 +1,48 @@
--# -path=.:../../lib/src/chunk:../../lib/src/translator:../phrasebook/gfos
concrete AppTha of App =
TranslateTha - [
-- Verb
SlashV2V, -- replaced by more efficient inlined versions
Slash2V3, Slash3V3, SlashV2S, SlashV2Q, SlashV2A,
SlashVV, SlashV2VNP,
AdvVPSlash, AdVVPSlash, VPSlashPrep,
-- Sentence
PredSCVP,
AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, RelS,
-- Question
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
-- Idiom
CleftNP, CleftAdv,
ImpP3
-- Construction
-- Extensions
]
,PhrasebookTha - [at_Prep, closed_A, open_A] --- - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A, at_Prep, by_Prep]
** open ParadigmsTha, SyntaxTha, Prelude in {
flags
literal=Symb ;
-- to suppress punctuation
lin
---- PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
---- PGreetingMale, PGreetingFemale = \s -> lin Text s ;
---- GObjectPlease o = lin Text (mkUtt o) ;
PhrasePhr p = {s = "+" ++ p.s} | p ;
Phrase_Chunk p = p ;
ComplV2V v np vp = mkVP v np vp ;
ComplV2A v np vp = mkVP v np vp ;
ComplV2Q v np vp = mkVP v np vp ;
ComplV2S v np vp = mkVP v np vp ;
ComplV3 v np vp = mkVP v np vp ;
}
+59
View File
@@ -0,0 +1,59 @@
all: Phrasebook App12.pgf
PROBSFILE=./app.probs
GFODIR=./gfos
.Phony: Phrasebook
Phrasebook:
cd ../phrasebook ; make forApp ; cd ../app
S=-s
GFMKT=mkdir -p $(GFODIR) && gf $S -make -literal=PN,Symb -probs=$(PROBSFILE) -gfo-dir $(GFODIR)
APP11=AppEng.pgf AppBul.pgf AppChi.pgf AppGer.pgf AppSwe.pgf AppHin.pgf AppFin.pgf AppFre.pgf AppIta.pgf AppSpa.pgf AppDut.pgf
APP12=$(APP11) AppCat.pgf
APP13=$(APP12) AppJpn.pgf
APP14=$(APP13) AppTha.pgf
# With dependencies:
App11.pgf: $(APP11)
$(GFMKT) -name=App11 $(APP11) +RTS -K200M
App12.pgf: $(APP12)
$(GFMKT) -name=App12 $(APP12) +RTS -K200M
App13.pgf: $(APP13)
$(GFMKT) -name=App13 $(APP13) +RTS -K200M
App14.pgf: $(APP14)
$(GFMKT) -name=App14 $(APP14) +RTS -K200M
# Without dependencies:
App11:
$(GFMKT) -name=App12 $(APP11) +RTS -K200M
App12:
$(GFMKT) -name=App12 $(APP12) +RTS -K200M
App13:
$(GFMKT) -name=App13 $(APP13) +RTS -K200M
App14:
$(GFMKT) -name=App14 $(APP14) +RTS -K200M
# App grammars for individual languages
AppEng.pgf:: ; $(GFMKT) -name=AppEng AppEng.gf
AppBul.pgf:: ; $(GFMKT) -name=AppBul AppBul.gf
AppCat.pgf:: ; $(GFMKT) -name=AppCat AppCat.gf +RTS -K100M
AppChi.pgf:: ; $(GFMKT) -name=AppChi AppChi.gf +RTS -K100M
AppDut.pgf:: ; $(GFMKT) -name=AppDut AppDut.gf +RTS -K64M
AppFin.pgf:: ; $(GFMKT) -name=AppFin AppFin.gf +RTS -K64M
AppGer.pgf:: ; $(GFMKT) -name=AppGer AppGer.gf +RTS -K64M
AppHin.pgf:: ; $(GFMKT) -name=AppHin AppHin.gf
AppFre.pgf:: ; $(GFMKT) -name=AppFre AppFre.gf +RTS -K64M
AppIta.pgf:: ; $(GFMKT) -name=AppIta AppIta.gf +RTS -K64M
AppJpn.pgf:: ; $(GFMKT) -name=AppJpn AppJpn.gf +RTS -K64M
AppSpa.pgf:: ; $(GFMKT) -name=AppSpa AppSpa.gf +RTS -K64M
AppSwe.pgf:: ; $(GFMKT) -name=AppSwe AppSwe.gf
AppTha.pgf:: ; $(GFMKT) -name=AppTha AppTha.gf
# language pairs to test
AppEngSwe: ; $(GFMKT) -name=AppEngSwe AppEng.pgf AppSwe.pgf
AppEngFin: ; $(GFMKT) -name=AppEngFin AppEng.pgf AppFin.pgf
AppEngChi: ; $(GFMKT) -name=AppEngChi AppEng.pgf AppChi.pgf
+7
View File
@@ -0,0 +1,7 @@
P=../phrasebook
L=../../lib/src
GFPATH=$L/chunk:$L/translator:$L/finnish/stemmed:$L/finnish:$P
J=-j +RTS -N4 -A20M -RTS
App.pgf::
gf -s -make $J -probs=./app.probs -path=$(GFPATH) -gfo-dir gfo App???.gf
+54
View File
@@ -0,0 +1,54 @@
module MissApp where
import qualified Data.Set as S
import qualified Data.Map as M
import Data.Char
-- prerequisite: pg -missing | wf -file=missing-app.txt
missFile = "missing-app.txt"
allLangs = words "AppBul AppCat AppChi AppDut AppEng AppFin AppFre AppGer AppHin AppIta AppSpa AppSwe"
type Lang = String
type Fun = String
type MissMap = M.Map Lang (S.Set Fun)
getMissMap :: FilePath -> IO MissMap
getMissMap file = do
ms <- readFile file >>= return . map words . lines
return $ M.fromList [(lang,S.fromList ws) | lang:":":ws <- ms]
ifMiss :: MissMap -> Lang -> Fun -> Bool
ifMiss mm lang fun = case M.lookup lang mm of
Just ws -> S.member fun ws
_ -> error $ "language not found: " ++ lang
allMissLangs :: MissMap -> Fun -> [Lang]
allMissLangs mm fun = [l | l <- allLangs, ifMiss mm l fun]
allMissFuns :: MissMap -> Lang -> [Fun]
allMissFuns mm lang = maybe [] S.toList $ M.lookup lang mm
isSyntaxFun :: Fun -> Bool
isSyntaxFun (f:un) = isUpper f && any isUpper un -- the latter to exclude Phrasebook
allMissingSyntaxFuns :: MissMap -> [(Lang,[Fun])]
allMissingSyntaxFuns mm = [(l,takeWhile isSyntaxFun $ allMissFuns mm l) | l <- allLangs] -- takeWhile works on the sorted list
allMissingSuchFuns :: MissMap -> (Fun -> Bool) -> [(Lang,[Fun])]
allMissingSuchFuns mm f = [(l,filter f $ allMissFuns mm l) | l <- allLangs]
allMissingThoseFuns :: MissMap -> [Fun] -> [(Lang,[Fun])]
allMissingThoseFuns mm fs = let s = S.fromList fs in allMissingSuchFuns mm (flip S.member s)
parts :: Fun -> [String]
parts f = words (map (\c -> if c =='_' then ' ' else c) f)
catOf :: Fun -> String
catOf = last . parts
prepareMissing :: MissMap -> Lang -> String -> IO ()
prepareMissing mm lang cat = putStrLn $ unlines
[ "lin " ++ p ++ " = mk" ++ cat ++ " \"\" ;"| (l,ps) <- allMissingSuchFuns mm (\f -> catOf f == cat), l == lang, p <- ps]
+35
View File
@@ -0,0 +1,35 @@
-- update the import list of every language
-- although possibly some extra definitions at the end
-- the new files are produced in ./tmp/
-- usage: runghc MkApp.hs
langs = words "Bul Cat Chi Dut Eng Fin Fre Ger Hin Ita Spa Swe"
appCnc lang = "App" ++ lang ++ ".gf"
appAbs = "App.gf"
main = do
imports <- readFile appAbs >>= return . getImports
mapM_ (\f -> readFile f >>= writeFile ("tmp/" ++ f) . (putImports imports)) (map appCnc langs)
getImports = takeWhile (/= ']') . tail . dropWhile (/='[')
putImports i s =
let
(s1,_:s2) = span (/='[') s
(_, s3) = span (/=']') s2
in s1 ++ "[" ++ i ++ extra s3
extra s = unlines (init (lines s) ++ extraLines ++ ["}"])
extraLines = -- [] -- default: no extra
[
"",
"ComplV2V v np vp = mkVP v np vp ;",
"ComplV2A v np vp = mkVP v np vp ;",
"ComplV2Q v np vp = mkVP v np vp ;",
"ComplV2S v np vp = mkVP v np vp ;",
"ComplV3 v np vp = mkVP v np vp ;",
""
]
+36
View File
@@ -0,0 +1,36 @@
Grammar for coloured translation app.
(c) Aarne Ranta 2014 under GPL. Last modified 6/5/2014.
1. Make sure you have the latest RGL compiled and available. Test this for instance in GF shell by typing
import alltenses/LangEng.gfo
2. Check that you have the following file structure, which holds in the standard GF
repository (darcs or github):
GF/lib/src/translator -- the translator extensions of RGL
GF/lib/src/german -- German RGL sources, needed for DictGer (morphological Dict)
GF/lib/src/finnish -- Finnish RGL sources, needed for StemFin
GF/lib/src/finnish/stemmed -- StemFin, a special file for compact Finnish runtime
GF/lib/src/api -- Syntax sources
GF/lib/src/chunk -- Chunk sources
GF/examples/phrasebook -- Phrasebook sources
GF/examples/app -- App sources (this directory)
3. Do 'make' and take a cup of coffee. If you have multiple cores, do first 'make Phrasebook' and then 'make -j App11.pgf' and take an espresso.
4. Go to GF/src/ui/android and follow the README
5. Before the final 'ant debug install', do the following:
cd assets/
rm *pgf*
cp -p <Your-GF>/examples/app/App11.pgf .
gf -make -split-pgf App11.pgf +RTS -K200M
rm App11.pgf
cd ..
ant debug install
Removing superfluous pgf files is recommended, because otherwise they will be copied to the app and
increase its size unnecessarily.
File diff suppressed because it is too large Load Diff