forked from GitHub/gf-core
Android app sources in examples/app - read README for advice
This commit is contained in:
43
examples/app/App.gf
Normal file
43
examples/app/App.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
abstract App =
|
||||
|
||||
-- modules in Grammar, excluding Structural
|
||||
Tense,
|
||||
Noun - [PPartNP], -- to be generalized
|
||||
Adjective,
|
||||
Numeral,
|
||||
Conjunction,
|
||||
Verb [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
Adverb,
|
||||
Phrase,
|
||||
Sentence,
|
||||
Question - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
Relative,
|
||||
Idiom [NP, VP, Cl, Tense, ProgrVP, ExistNP],
|
||||
|
||||
Symbol [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], ---- why only these?
|
||||
|
||||
Chunk,
|
||||
|
||||
---- Construction,
|
||||
Extensions [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
Dictionary,
|
||||
Documentation
|
||||
|
||||
,Phrasebook
|
||||
|
||||
** {
|
||||
flags
|
||||
startcat=Phr ;
|
||||
|
||||
fun
|
||||
PhrasePhr : Phrase -> Phr ;
|
||||
Phrase_Chunk : Phrase -> Chunk ;
|
||||
|
||||
}
|
||||
61
examples/app/AppBul.gf
Normal file
61
examples/app/AppBul.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppBul of App =
|
||||
TenseX - [IAdv, CAdv],
|
||||
NounBul - [PPartNP],
|
||||
AdjectiveBul,
|
||||
NumeralBul,
|
||||
SymbolBul [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionBul,
|
||||
VerbBul [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbBul,
|
||||
PhraseBul,
|
||||
SentenceBul [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionBul - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeBul,
|
||||
IdiomBul [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionBul,
|
||||
|
||||
ChunkBul,
|
||||
|
||||
ExtensionsBul [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationBul,
|
||||
DictionaryBul
|
||||
|
||||
,PhrasebookBul - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
|
||||
|
||||
** open MorphoBul, ResBul, ParadigmsBul, SyntaxBul, CommonScand, (E = ExtraBul), 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) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
76
examples/app/AppChi.gf
Normal file
76
examples/app/AppChi.gf
Normal file
@@ -0,0 +1,76 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppChi of App =
|
||||
TenseChi,
|
||||
NounChi - [PPartNP],
|
||||
AdjectiveChi,
|
||||
NumeralChi,
|
||||
SymbolChi [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionChi,
|
||||
VerbChi [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbChi,
|
||||
PhraseChi,
|
||||
SentenceChi [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionChi - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
|
||||
QuestCl -- overridden
|
||||
],
|
||||
RelativeChi,
|
||||
IdiomChi [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionChi,
|
||||
|
||||
ChunkChi,
|
||||
|
||||
ExtensionsChi [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationChi,
|
||||
DictionaryChi
|
||||
|
||||
,PhrasebookChi - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A, at_Prep]
|
||||
|
||||
** open ResChi, ParadigmsChi, SyntaxChi, CommonScand, (E = ExtraChi), (G = GrammarChi), Prelude in {
|
||||
|
||||
flags
|
||||
literal=Symb ;
|
||||
|
||||
|
||||
-- Chinese-specific overrides
|
||||
|
||||
lin
|
||||
CompAP = G.CompAP | E.CompBareAP ; -- he is good | he good
|
||||
|
||||
-- AdvVP vp adv = E.TopicAdvVP vp adv | G.AdvVP vp adv ; -- he *today* here sleeps | *today* he here sleeps
|
||||
|
||||
QuestCl cl = G.QuestCl cl | E.QuestRepV cl ; -- he comes 'ma' | he come not come
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- to suppress punctuation
|
||||
lin
|
||||
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
|
||||
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
|
||||
|
||||
GObjectPlease o = lin Text (mkUtt o) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
72
examples/app/AppEng.gf
Normal file
72
examples/app/AppEng.gf
Normal file
@@ -0,0 +1,72 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppEng of App =
|
||||
TenseX - [Pol, PNeg, PPos],
|
||||
CatEng,
|
||||
NounEng - [PPartNP],
|
||||
AdjectiveEng,
|
||||
NumeralEng,
|
||||
SymbolEng [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP,
|
||||
addGenitiveS
|
||||
],
|
||||
ConjunctionEng,
|
||||
VerbEng [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbEng,
|
||||
PhraseEng,
|
||||
SentenceEng [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionEng - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeEng,
|
||||
IdiomEng [NP, VP, Tense, Cl, ProgrVP, ExistNP],
|
||||
|
||||
---- ConstructionEng,
|
||||
|
||||
|
||||
ChunkEng,
|
||||
|
||||
ExtensionsEng [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
DocumentationEng,
|
||||
DictionaryEng
|
||||
|
||||
,PhrasebookEng - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv]
|
||||
|
||||
** open MorphoEng, ResEng, ParadigmsEng, SyntaxEng, (G = GrammarEng), (E = ExtraEng), Prelude in {
|
||||
|
||||
flags
|
||||
literal=Symb ;
|
||||
|
||||
-- exceptional linearizations
|
||||
lin
|
||||
UseCl t p cl =
|
||||
G.UseCl t p cl -- I am here
|
||||
| E.ContractedUseCl t p cl -- I'm here
|
||||
;
|
||||
|
||||
PPos = {s = [] ; p = CPos} ;
|
||||
PNeg = {s = [] ; p = CNeg True} | {s = [] ; p = CNeg False} ;
|
||||
|
||||
|
||||
-- to suppress punctuation
|
||||
lin
|
||||
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
|
||||
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
|
||||
|
||||
GObjectPlease o = lin Text (mkUtt o) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
70
examples/app/AppFin.gf
Normal file
70
examples/app/AppFin.gf
Normal file
@@ -0,0 +1,70 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
--# -path=.:src/chunk:src/finnish/stemmed:src/finnish:src/api:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppFin of App =
|
||||
TenseX,
|
||||
NounFin - [
|
||||
PPartNP,
|
||||
UsePron, PossPron -- Fin specific: replaced by variants with prodrop
|
||||
],
|
||||
AdjectiveFin,
|
||||
NumeralFin,
|
||||
SymbolFin [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionFin,
|
||||
VerbFin [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbFin,
|
||||
PhraseFin,
|
||||
SentenceFin [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionFin - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeFin,
|
||||
IdiomFin [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionFin,
|
||||
|
||||
ChunkFin,
|
||||
|
||||
ExtensionsFin [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationFin,
|
||||
DictionaryFin
|
||||
|
||||
,PhrasebookFin - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_A]
|
||||
|
||||
** open MorphoFin, ResFin, ParadigmsFin, SyntaxFin, CommonScand, (E = ExtraFin), (G = GrammarFin), Prelude in {
|
||||
|
||||
flags
|
||||
literal=Symb ;
|
||||
|
||||
-- pro-drop exceptions: here as second rather than first alternative
|
||||
lin
|
||||
UsePron p = G.UsePron p | G.UsePron (E.ProDrop p) ;
|
||||
PossPron p = G.PossPron p | E.ProDropPoss p ;
|
||||
|
||||
-- to suppress punctuation
|
||||
lin
|
||||
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
|
||||
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
|
||||
|
||||
GObjectPlease o = lin Text (mkUtt o) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
95
examples/app/AppFre.gf
Normal file
95
examples/app/AppFre.gf
Normal file
@@ -0,0 +1,95 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppFre of App =
|
||||
TenseFre,
|
||||
NounFre - [PPartNP],
|
||||
AdjectiveFre,
|
||||
NumeralFre,
|
||||
SymbolFre [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionFre,
|
||||
VerbFre [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbFre,
|
||||
PhraseFre,
|
||||
SentenceFre [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionFre - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP,
|
||||
QuestCl, QuestIAdv
|
||||
],
|
||||
RelativeFre,
|
||||
IdiomFre [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionFre,
|
||||
|
||||
ChunkFre,
|
||||
|
||||
ExtensionsFre [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationFre,
|
||||
DictionaryFre
|
||||
|
||||
,PhrasebookFre - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_A]
|
||||
|
||||
** open MorphoFre, PhonoFre, ResFre, ParadigmsFre, SyntaxFre, CommonScand, (E = ExtraFre), (G = GrammarFre), Prelude in {
|
||||
|
||||
flags
|
||||
literal=Symb ;
|
||||
|
||||
---------------------------
|
||||
lin
|
||||
QuestCl cl =
|
||||
{s = \\t,a,p => -- est-ce qu'il dort ?
|
||||
let cls = cl.s ! DDir ! t ! a ! p
|
||||
in table {
|
||||
QDir => "est-ce" ++ elisQue ++ cls ! Indic ;
|
||||
QIndir => subjIf ++ cls ! Indic
|
||||
}
|
||||
}
|
||||
| {s = \\t,a,p => -- dort-il ?
|
||||
let cls = cl.s ! DInv ! t ! a ! p
|
||||
in table {
|
||||
QDir => cls ! Indic ;
|
||||
QIndir => subjIf ++ cls ! Indic
|
||||
}
|
||||
}
|
||||
| G.QuestCl cl -- il dort ?
|
||||
;
|
||||
|
||||
|
||||
QuestIAdv iadv cl =
|
||||
G.QuestIAdv iadv cl -- où dort-il
|
||||
| {s = \\t,a,p,q => -- où est-ce qu'il dort
|
||||
let
|
||||
ord = DDir ;
|
||||
cls = cl.s ! ord ! t ! a ! p ! Indic ;
|
||||
why = iadv.s
|
||||
in why ++ "est-ce" ++ elisQue ++ cls
|
||||
} ;
|
||||
|
||||
---------------------------
|
||||
|
||||
-- to suppress punctuation
|
||||
lin
|
||||
PSentence, PQuestion = \s -> lin Text (mkUtt s) ;
|
||||
PGreetingMale, PGreetingFemale = \s -> lin Text s ;
|
||||
|
||||
GObjectPlease o = lin Text (mkUtt o) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
61
examples/app/AppGer.gf
Normal file
61
examples/app/AppGer.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppGer of App =
|
||||
TenseGer,
|
||||
NounGer - [PPartNP],
|
||||
AdjectiveGer,
|
||||
NumeralGer,
|
||||
SymbolGer [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionGer,
|
||||
VerbGer [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbGer,
|
||||
PhraseGer,
|
||||
SentenceGer [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionGer - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeGer,
|
||||
IdiomGer [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionGer,
|
||||
|
||||
ChunkGer,
|
||||
|
||||
ExtensionsGer [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationGer,
|
||||
DictionaryGer
|
||||
|
||||
,PhrasebookGer - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
|
||||
|
||||
** open MorphoGer, ResGer, ParadigmsGer, SyntaxGer, CommonScand, (E = ExtraGer), 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) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
61
examples/app/AppHin.gf
Normal file
61
examples/app/AppHin.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppHin of App =
|
||||
TenseX - [AdN,Adv,SC,PPos,PNeg],
|
||||
NounHin - [PPartNP],
|
||||
AdjectiveHin,
|
||||
NumeralHin,
|
||||
SymbolHin [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionHin,
|
||||
VerbHin [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbHin,
|
||||
PhraseHin,
|
||||
SentenceHin [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionHin - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeHin,
|
||||
IdiomHin [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionHin,
|
||||
|
||||
ChunkHin,
|
||||
|
||||
ExtensionsHin [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationHin,
|
||||
DictionaryHin
|
||||
|
||||
,PhrasebookHin - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_Adv, closed_A, open_A]
|
||||
|
||||
** open MorphoHin, ResHin, ParadigmsHin, SyntaxHin, CommonScand, (E = ExtraHin), 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) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
61
examples/app/AppIta.gf
Normal file
61
examples/app/AppIta.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppIta of App =
|
||||
TenseIta,
|
||||
NounIta - [PPartNP],
|
||||
AdjectiveIta,
|
||||
NumeralIta,
|
||||
SymbolIta [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionIta,
|
||||
VerbIta [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbIta,
|
||||
PhraseIta,
|
||||
SentenceIta [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionIta - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeIta,
|
||||
IdiomIta [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionIta,
|
||||
|
||||
ChunkIta,
|
||||
|
||||
ExtensionsIta [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationIta,
|
||||
DictionaryIta
|
||||
|
||||
,PhrasebookIta - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, open_A]
|
||||
|
||||
** open MorphoIta, ResIta, ParadigmsIta, SyntaxIta, CommonScand, (E = ExtraIta), 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) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
61
examples/app/AppSpa.gf
Normal file
61
examples/app/AppSpa.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppSpa of App =
|
||||
TenseSpa,
|
||||
NounSpa - [PPartNP],
|
||||
AdjectiveSpa,
|
||||
NumeralSpa,
|
||||
SymbolSpa [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionSpa,
|
||||
VerbSpa [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbSpa,
|
||||
PhraseSpa,
|
||||
SentenceSpa [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionSpa - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeSpa,
|
||||
IdiomSpa [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionSpa,
|
||||
|
||||
ChunkSpa,
|
||||
|
||||
ExtensionsSpa [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationSpa,
|
||||
DictionarySpa
|
||||
|
||||
,PhrasebookSpa - [PSentence, PQuestion, PGreetingMale, PGreetingFemale, GObjectPlease, cheap_A,expensive_A, open_A]
|
||||
|
||||
** open MorphoSpa, ResSpa, ParadigmsSpa, SyntaxSpa, CommonScand, (E = ExtraSpa), 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) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
61
examples/app/AppSwe.gf
Normal file
61
examples/app/AppSwe.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
--# -path=.:src/chunk:src/translator:../examples/phrasebook/gfos
|
||||
|
||||
concrete AppSwe of App =
|
||||
TenseSwe,
|
||||
NounSwe - [PPartNP],
|
||||
AdjectiveSwe,
|
||||
NumeralSwe,
|
||||
SymbolSwe [
|
||||
PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP
|
||||
],
|
||||
ConjunctionSwe,
|
||||
VerbSwe [
|
||||
UseV,ComplVV,SlashV2a,ComplSlash,UseComp,CompAP,CompNP,CompAdv,CompCN
|
||||
],
|
||||
AdverbSwe,
|
||||
PhraseSwe,
|
||||
SentenceSwe [
|
||||
PredVP,SlashVP,ImpVP,
|
||||
UseCl,UseQCl,UseSlash,SSubjS,UseRCl
|
||||
],
|
||||
QuestionSwe - [
|
||||
ComplSlashIP,AdvQVP,AddAdvQVP,QuestQVP
|
||||
],
|
||||
RelativeSwe,
|
||||
IdiomSwe [
|
||||
NP, VP, Tense, Cl, ProgrVP, ExistNP,
|
||||
neutr, sjalv
|
||||
],
|
||||
---- ConstructionSwe,
|
||||
|
||||
ChunkSwe,
|
||||
|
||||
ExtensionsSwe [
|
||||
CompoundCN,AdAdV,UttAdV,ApposNP,
|
||||
MkVPI, MkVPS, PredVPS, that_RP, who_RP
|
||||
],
|
||||
|
||||
DocumentationSwe,
|
||||
DictionarySwe
|
||||
|
||||
,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) ;
|
||||
|
||||
|
||||
lin
|
||||
PhrasePhr p = {s = "+" ++ p.s} | p ;
|
||||
|
||||
Phrase_Chunk p = p ;
|
||||
|
||||
}
|
||||
48
examples/app/Makefile
Normal file
48
examples/app/Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
all: AppEng.pgf AppSwe.pgf AppBul.pgf AppIta.pgf AppSpa.pgf AppFre.pgf AppGer.pgf AppHin.pgf AppChi.pgf AppFin.pgf App10
|
||||
|
||||
PROBSFILE=./app.probs
|
||||
GFODIR=./gfos
|
||||
|
||||
S=-s
|
||||
GFMKT=mkdir -p $(GFODIR) && gf $S -make -literal=Symb -probs=$(PROBSFILE) -gfo-dir $(GFODIR)
|
||||
|
||||
|
||||
# Dummy targets, just for convenience
|
||||
App: AppEng AppBul AppChi AppGer AppSwe AppHin AppFin AppFre AppIta AppSpa App10
|
||||
AppEng: AppEng.pgf
|
||||
AppBul: AppBul.pgf
|
||||
AppChi: AppChi.pgf
|
||||
AppGer: AppGer.pgf
|
||||
AppSwe: AppSwe.pgf
|
||||
AppHin: AppHin.pgf
|
||||
AppFin: AppFin.pgf
|
||||
AppFre: AppFre.pgf
|
||||
AppIta: AppIta.pgf
|
||||
AppSpa: AppSpa.pgf
|
||||
|
||||
TRANSLATE10=AppEng.pgf AppBul.pgf AppChi.pgf AppGer.pgf AppSwe.pgf AppHin.pgf AppFin.pgf AppFre.pgf AppIta.pgf AppSpa.pgf
|
||||
|
||||
# Without dependencies:
|
||||
App10:
|
||||
$(GFMKT) -name=App10 $(TRANSLATE10) +RTS -K200M
|
||||
|
||||
# With dependencies:
|
||||
App10.pgf: $(TRANSLATE10)
|
||||
$(GFMKT) -name=App8 $(TRANSLATE10) +RTS -K200M
|
||||
|
||||
# App grammars for individual languages
|
||||
AppEng.pgf:: ; $(GFMKT) -name=AppEng AppEng.gf
|
||||
AppBul.pgf:: ; $(GFMKT) -name=AppBul AppBul.gf
|
||||
AppChi.pgf:: ; $(GFMKT) -name=AppChi AppChi.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
|
||||
AppSpa.pgf:: ; $(GFMKT) -name=AppSpa AppSpa.gf +RTS -K64M
|
||||
AppSwe.pgf:: ; $(GFMKT) -name=AppSwe AppSwe.gf
|
||||
|
||||
# language pairs to test
|
||||
AppEngSwe: ; $(GFMKT) -name=AppEngSwe AppEng.pgf AppSwe.pgf
|
||||
App10: ; $(GFMKT) -name=App10 AppEng.pgf AppSwe.pgf AppBul.pgf AppIta.pgf AppSpa.pgf AppFre.pgf AppGer.pgf AppHin.pgf AppChi.pgf AppFin.pgf +RTS -K200M
|
||||
|
||||
43
examples/app/README
Normal file
43
examples/app/README
Normal file
@@ -0,0 +1,43 @@
|
||||
Grammar for coloured translation app.
|
||||
|
||||
(c) Aarne Ranta 2014 under GPL
|
||||
|
||||
1. Make sure you have the latest RGL compiled.
|
||||
|
||||
2. Prepare Phrasebook for this: you need to have the gfo's in the subdir phrasebook/gfos/
|
||||
|
||||
cd ../phrasebook
|
||||
make
|
||||
make Chi
|
||||
make gfos
|
||||
cd ../app
|
||||
|
||||
3. Back in this directory, make sure you have GF_LIB_PATH pointing to a place under which you can find all of
|
||||
|
||||
$(GF_LIB_PATH)/alltenses
|
||||
$(GF_LIB_PATH)/prelude
|
||||
$(GF_LIB_PATH)/src/translator
|
||||
$(GF_LIB_PATH)/src/finnish
|
||||
$(GF_LIB_PATH)/src/finnish/stemmed
|
||||
$(GF_LIB_PATH)/src/api
|
||||
$(GF_LIB_PATH)/src/chunk
|
||||
$(GF_LIB_PATH)/../examples/phrasebook
|
||||
$(GF_LIB_PATH)/../examples/app
|
||||
|
||||
This is what I have since I am compiling RGL with 'make' in lib/src. But the standard procedure builds RGL elsewhere and
|
||||
you cannot reach the non-standard source files relative to GF_LIB_PATH. Fix this by symbolic links or other means.
|
||||
|
||||
4. Do 'make' and take a cup of coffee.
|
||||
|
||||
5. Go to GF/src/ui/android and follow the README
|
||||
|
||||
6. Before the final 'ant debug install', do the following:
|
||||
|
||||
cd assets/
|
||||
rm *
|
||||
cp -p <Your-GF>/examples/app/App10.pgf .
|
||||
gf -make -split-pgf App10.pgf +RTS -K200M
|
||||
rm App10.pgf
|
||||
cd ..
|
||||
ant debug install
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
compile = runghc Compile
|
||||
|
||||
Chi:
|
||||
$(compile) Chi
|
||||
|
||||
all: demo missing gfos
|
||||
|
||||
gfos:
|
||||
|
||||
Reference in New Issue
Block a user