Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODELS.
- Language:
- string: code
- string: name
- array: word variants
- array: phonetic variants
- helper methods: has word variants, has phonetic variants
- add to session: which word variant? which phonetic variant?
- Entry:
- string: word
- array of strings: word variants
- string: phonetic
- array of strings: phonetic variants
- reference to a Language (language that the word is in)
- reference to a PartOfSpeech
- JSON: lang-and-pos-specific data
- string: critical data
- PartOfSpeech:
- string: name
- reference to a Language
- hash of properties:
- {
- name: "gender",
- values: [ "m", "f", "n" ],
- required: true
- }
- TargetLanguageDetails:
- reference to a Word
- reference to a Language (that these details are written in)
- text field: definitions
- text field: notes
- GrammaticalTerm:
- reference to a Language
- string: internal term
- GrammaticalTermTranslation:
- reference to a Language
- reference to a GrammaticalTerm
- string: translation
- ============
- have a list of required fields for each lang-pos combo (in a certain order) plus whether they need to be localized
- on updating / creating:
- validate the JSON.
- make sure the JSON has exactly the right required fields
- make sure that for any fields that should be restricted to certain values, those values are ok
- validate the grammatical terms in {} for TargetLanguageDetails notes and critical data of Entries
- on viewing:
- display the fields in order
- localize GrammaticalTerms
- cron checks:
- - does every grammaticalterm have a translation?
- - if the main target language's notes etc. have been updated, have the other target languages' notes been updated too?
- ============
- UNIT TESTS.
- Language:
- language code should be present
- language code should be exactly two characters
- language code should be unique
- language name should be present
- arrays should be either empty or >2 in length
- test the helper methods
- Entry:
- language, pos should be non empty
- if language has word variants, word variants should be non empty and word should be empty
- word variants length should be the same as language's word variants array
- if language does not have word variants, word should be non empty and word variants should be empty
- (repeat for phonetic variants)
- for each property in property hash:
- property should be present as key in POS property hash
- if POS property hash has list of acceptable values, then property value should be in that list
- value should not be empty
- all required properties from POS property hash should be in the property hash
- PartOfSpeech:
- all fields should be present
- name should be unique within PartsOfSpeech with same language
- everything in hash should have name and required keys
- TargetLanguageDetails:
- Word and Language references should be present
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement