How to use symbols / punctuation in discriminatory unions

I am trying to create a discriminated union for a portion of speech tags and other tags returned by a natural language parser.

It is customary to use either strings or enumerations for them in C # / Java, but discriminatory unions seem more appropriate in F # because they are different read-only values.

In a link to the language, I found that this character ``...`` can be used to distinguish between keywords / reserved words. It works for

type ArgumentType =
| A0 // subject
| A1 // indirect object
| A2 // direct object
| A3 //
| A4 //
| A5 //
| AA //
| ``AM-ADV``

However, tags contain characters like $, for example.

type PosTag =
| CC // Coordinating conjunction
| CD // Cardinal Number
| DT // Determiner
| EX // Existential there
| FW // Foreign Word
| IN // Preposision or subordinating conjunction
| JJ // Adjective
| JJR // Adjective, comparative
| JJS // Adjective, superlative
| LS // List Item Marker
| MD // Modal
| NN // Noun, singular or mass
| NNP // Proper Noun, singular
| NNPS // Proper Noun, plural
| NNS // Noun, plural
| PDT // Predeterminer
| POS // Possessive Ending
| PRP // Personal Pronoun
| PRP$ //$ Possessive Pronoun
| RB // Adverb
| RBR // Adverb, comparative
| RBS // Adverb, superlative
| RP // Particle
| SYM // Symbol
| TO // to
| UH // Interjection
| VB // Verb, base form
| VBD // Verb, past tense
| VBG // Verb, gerund or persent participle
| VBN // Verb, past participle
| VBP // Verb, non-3rd person singular present
| VBZ // Verb, 3rd person singular present
| WDT // Wh-determiner
| WP // Wh-pronoun
| WP$ //$ Possessive wh-pronoun
| WRB // Wh-adverb
| ``#``
| ``$``
| ``''``
| ``(``
| ``)``
| ``,``
| ``.``
| ``:``
| `` //not sure how to escape/delimit this

``...`` not working for WP $ or characters like (

Also, I have an interesting problem that the parser returns `` as a meaningful character, so I also need to avoid it.

- , ?

  • , ,

, - toString - ?

+3
2

, .

, DU ToString, .

+1

, / , Bindings . , ( @, F # codegen).

, DU, , .

. ., /, *, +, $, [, ], \ & " , , ".

+1

Source: https://habr.com/ru/post/1750398/


All Articles