test (Polyglot)¶
In [ ]:
//// test
open testing
In [ ]:
nominal i = ()
nominal e = ()
nominal s = ()
nominal n = ()
nominal t = ()
nominal f = ()
nominal j = ()
nominal p = ()
union sensing =
| Si : s * i
| Se : s * e
union intuition =
| Ni : n * i
| Ne : n * e
union thinking =
| Ti : t * i
| Te : t * e
union feeling =
| Fi : f * i
| Fe : f * e
union function_stack =
| FS : sensing * intuition * thinking * feeling
union personality_type =
| ISTJ : i * s * t * j * function_stack
| ISFJ : i * s * f * j * function_stack
| INFJ : i * n * f * j * function_stack
| INTJ : i * n * t * j * function_stack
| ISTP : i * s * t * p * function_stack
| ISFP : i * s * f * p * function_stack
| INFP : i * n * f * p * function_stack
| INTP : i * n * t * p * function_stack
| ESTP : e * s * t * p * function_stack
| ESFP : e * s * f * p * function_stack
| ENFP : e * n * f * p * function_stack
| ENTP : e * n * t * p * function_stack
| ESTJ : e * s * t * j * function_stack
| ESFJ : e * s * f * j * function_stack
| ENFJ : e * n * f * j * function_stack
| ENTJ : e * n * t * j * function_stack
inl main () =
inl istj_stack = FS ((Si (s, i)), Ne (n, e), (Te (t, e)), (Fi (f, i)))
inl istj_personality = ISTJ (i, s, t, j, istj_stack)
// inl isfj_stack = FS ((Si (s, i)), Ne (n, e), (Fe (f, e)), (Ti (t, i)))
// inl isfj_personality = ISFJ (i, s, f, j, isfj_stack)
;[
istj_personality
]
|> fun x => $'$"%A{!x}"' : string
|> console.write_line
inl main () =
$'!main ()' : ()
[|US5_0 (US4_0 (US0_0, US1_1, US2_1, US3_0))|]
In [ ]:
type PhonologicalFeature =
| VowelFeature of
height: Height
* backness: Backness
* roundedness: Roundedness
* tone: Option<Tone>
* stress: Option<Stress>
* length: Option<Length>
| ConsonantFeature of
place: PlaceOfArticulation
* manner: MannerOfArticulation
* voicing: Voicing
* length: Option<Length>
| VowelHarmonyFeature
| PitchAccentFeature
and Stress = Primary | Secondary
and Length = Long | Short | HalfLong
and Height =
| High | NearHigh | HighMid
| Mid | LowMid | NearLow
| Low
and Backness = Front | Central | Back
and Roundedness = Rounded | Unrounded
and PlaceOfArticulation =
| Bilabial | Labiodental | Dental
| Alveolar | Postalveolar | Retroflex
| Palatal | Velar | Uvular
| Pharyngeal | Epiglottal | Glottal
and MannerOfArticulation =
| Plosive | Nasal | Trill
| TapOrFlap | Fricative | LateralFricative
| Approximant | LateralApproximant
and Voicing = Voiced | Voiceless
and SecondaryArticulation =
| Labialization | Palatalization | Velarization
| Pharyngealization | Aspiration
and Tone =
| LevelTone of int
| ContourTone of int list
and MorphologicalFeature =
| RootFeature of string
| AffixFeature of AffixType * string
| IncorporationFeature of string * MorphologicalFeature
| NonConcatenativePattern of string * string
| AgglutinativeAffixFeature of AgglutinativeAffixType * string
| HonorificFeature of HonorificType * string
and AgglutinativeAffixType = Suffix | Prefix
and HonorificType = VerbHonorific | NounHonorific
and AffixType =
| Prefix | Suffix | Infix
| Circumfix
type SyntacticFeature =
| WordFeature of MorphologicalFeature list * LexicalCategory
| PhraseFeature of PhraseType * SyntacticFeature list
| GrammaticalRelation of GrammaticalRelationType * SyntacticFeature list
| SOVOrderFeature
| TopicCommentFeature
and GrammaticalRelationType =
| Ergative | Absolutive | Nominative
| Accusative
and LexicalCategory =
| Noun | Verb | Adjective
| Adverb | Pronoun | Preposition
| Conjunction | Determiner | Interjection
and PhraseType =
| NP | VP | AP
| PP | CP
and SemanticFeature =
| Meaning of string
| SemanticRole of SemanticRoleType * SemanticFeature
and SemanticRoleType =
| Agent | Patient | Instrument
| Location | Time | Cause
and PragmaticFeature =
| UseContext of string
| PolitenessLevel of Politeness
| SpeechAct of SpeechActType
| SpeechLevel of SpeechLevelType
and Politeness = Formal | Informal | Neutral
and SpeechActType =
| Assertive | Directive | Commissive
| Expressive | Declarative
and SpeechLevelType =
| FormalHigh | FormalLow | InformalHigh
| InformalLow | Neutral
type LinguisticFeature =
| Phonological of PhonologicalFeature
| Morphological of MorphologicalFeature
| Syntactic of SyntacticFeature
| Semantic of SemanticFeature
| Pragmatic of PragmaticFeature
type LanguageConstruct =
| LanguageElement of LinguisticFeature
| LanguageStructure of LanguageConstruct list
| TranslationElement of TranslationFeature
and TranslationFeature =
| LinkedPhonological of PhonologicalFeature * PhonologicalFeature
| LinkedMorphological of MorphologicalFeature * MorphologicalFeature
| LinkedSyntactic of SyntacticFeature * SyntacticFeature
| LinkedSemantic of SemanticFeature * SemanticFeature
type Discourse = DiscourseUnit of LanguageConstruct list
type LanguageModel =
| Model of discourse: Discourse
In [ ]:
let testEnglish =
Model(
DiscourseUnit [
LanguageElement (Phonological (ConsonantFeature (Alveolar, Nasal, Voiced, Some(HalfLong))));
LanguageElement (Phonological (VowelFeature (High, Front, Unrounded, Some(LevelTone 1), Some(Primary), Some(Short))));
LanguageElement (Phonological (VowelFeature (Low, Front, Unrounded, Some(LevelTone 2), Some(Secondary), Some(Long))));
LanguageElement (Phonological (ConsonantFeature (Velar, Plosive, Voiceless, Some(HalfLong))));
LanguageElement (Morphological (RootFeature "I"));
LanguageElement (Morphological (RootFeature "see"));
LanguageElement (Morphological (RootFeature "a"));
LanguageElement (Morphological (RootFeature "cat"));
LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "I"], Pronoun)])));
LanguageElement (Syntactic (PhraseFeature (VP, [WordFeature ([RootFeature "see"], Verb)])));
LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "a"; RootFeature "cat"], Noun)])));
LanguageElement (Semantic (Meaning "Perception act of a feline by the speaker"));
LanguageElement (Pragmatic (UseContext "Statement of an action being observed"))
]
)
let testPortuguese =
Model(
DiscourseUnit [
LanguageElement (Phonological (VowelFeature (High, Front, Unrounded, Some(LevelTone 1), Some(Primary), Some(Short))));
LanguageElement (Phonological (VowelFeature (Low, Front, Unrounded, Some(LevelTone 2), Some(Secondary), Some(Long))));
LanguageElement (Phonological (VowelFeature (Mid, Back, Rounded, Some(LevelTone 3), Some(Primary), Some(Short))));
LanguageElement (Phonological (ConsonantFeature (Velar, Plosive, Voiceless, Some(HalfLong))));
LanguageElement (Morphological (RootFeature "Eu"));
LanguageElement (Morphological (RootFeature "ver" |> ignore; AffixFeature (Suffix, "o")));
LanguageElement (Morphological (RootFeature "um"));
LanguageElement (Morphological (RootFeature "gato"));
LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "Eu"], Pronoun)])));
LanguageElement (Syntactic (PhraseFeature (VP, [WordFeature ([RootFeature "vejo"], Verb)])));
LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "um"; RootFeature "gato"], Noun)])));
LanguageElement (Semantic (Meaning "Ação de percepção de um felino pelo falante"));
LanguageElement (Pragmatic (UseContext "Declaração de uma ação sendo observada"))
]
)
let testKorean =
Model(
DiscourseUnit [
LanguageElement (Phonological (ConsonantFeature (Alveolar, Nasal, Voiced, Some(Short))));
LanguageElement (Phonological (VowelFeature (High, Back, Rounded, None, None, Some(Short))));
LanguageElement (Phonological (VowelFeature (Mid, Front, Unrounded, None, None, Some(Long))));
LanguageElement (Phonological (ConsonantFeature (Bilabial, Plosive, Voiceless, Some(Short))));
LanguageElement (Morphological (RootFeature "나"));
LanguageElement (Morphological (RootFeature "보다"));
LanguageElement (Morphological (AffixFeature (Suffix, "아")));
LanguageElement (Morphological (RootFeature "고양이"));
LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "나"], Pronoun)])));
LanguageElement (Syntactic (PhraseFeature (VP, [WordFeature ([RootFeature "보다"; AffixFeature (Suffix, "아")], Verb)])));
LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "고양이"], Noun)])));
LanguageElement (Semantic (Meaning "화자에 의한 고양이의 관찰 행위"));
LanguageElement (Pragmatic (UseContext "관찰되고 있는 행동의 진술"))
]
)
main¶
In [ ]:
inl main (_args : array_base string) =
0i32
inl main () =
$'let main args = !main args' : ()
In [ ]:
inl app () =
"test" |> console.write_line
0i32
inl main () =
print_static "<test>"
app
|> dyn
|> ignore
print_static "</test>"