File tree Expand file tree Collapse file tree
main/kotlin/cc/wordview/gengolex/word
resources/dictionaries/kanji Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ @file:Suppress(" PropertyName" )
2+
13package cc.wordview.gengolex.word
24
35/* *
46 * Represents a word in any given language.
57 *
68 * @property parent Identifier used to associate a word to a global equivalent of it (basically the translation of it in english)
79 * @property word The word itself in the respective language
10+ * @property translation_parent The parent used to look for translations
811 * @property representable Indicates whether this word is representable by an image/illustration
912 * @property pronunciation How the word is spelled
1013 */
1114open class Word (
1215 val parent : String ,
1316 val word : String ,
17+ val translation_parent : String? = null ,
1418 val representable : Boolean = false ,
1519 val pronunciation : String? = null ,
1620)
Original file line number Diff line number Diff line change 1+ package parser
2+
3+ import GengolexTest
4+ import cc.wordview.gengolex.Language
5+ import cc.wordview.gengolex.Parser
6+ import kotlin.test.Test
7+ import kotlin.test.assertEquals
8+
9+ class TranslationParentFieldTest : GengolexTest () {
10+ @Test
11+ fun japanese () {
12+ val parser = Parser (Language .JAPANESE , dictionaries)
13+ val word = parser.findWords(" 悲しみどうでもいい" ).single()
14+ assertEquals(" sadness" , word.translation_parent)
15+ }
16+
17+ @Test
18+ fun japanese_noTranslationParent () {
19+ val parser = Parser (Language .JAPANESE , dictionaries)
20+ val word = parser.findWords(" 雨が降る" ).single()
21+ assertEquals(null , word.translation_parent)
22+ }
23+ }
Original file line number Diff line number Diff line change 3131 "representable" : true
3232 }
3333 ]
34+ },
35+ {
36+ "parent" : " sad" ,
37+ "word" : " 悲" ,
38+ "representable" : true ,
39+ "derivations" : [
40+ {
41+ "parent" : " sad" ,
42+ "translation_parent" : " sadness" ,
43+ "word" : " 悲しみ" ,
44+ "representable" : true
45+ }
46+ ]
3447 }
3548]
You can’t perform that action at this time.
0 commit comments