Skip to content

Commit

Permalink
rm morpheme.wordInfo test method
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-northlander committed Nov 25, 2024
1 parent 938ab50 commit 1aa19ec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import com.worksap.nlp.sudachi.dictionary.POS
import com.worksap.nlp.sudachi.morpheme
import com.worksap.nlp.sudachi.res
import com.worksap.nlp.sudachi.setCharacterCategory
import com.worksap.nlp.sudachi.wordInfo
import kotlin.test.*

fun DicBuilder.System.lexicon(s: String): DicBuilder.System {
Expand Down Expand Up @@ -57,7 +56,7 @@ class SystemDicTest {
assertEquals(11, dic.lexicon.size()) // 10 + 南
assertEquals(POS("名詞", "普通名詞", "一般", "*", "*", "*"), dic.grammar.getPartOfSpeechString(0))
val m = dic.morpheme(44) // 11th word (i.e. 南)
val wi = m.wordInfo
val wi = dic.lexicon.getWordInfo(m.getWordId())
assertEquals("", m.surface())
assertEquals(3, wi.length)
assertEquals(0, wi.posId)
Expand Down
11 changes: 0 additions & 11 deletions src/test/java/com/worksap/nlp/sudachi/morphemes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.worksap.nlp.sudachi
import com.worksap.nlp.sudachi.dictionary.CharacterCategory
import com.worksap.nlp.sudachi.dictionary.DictionaryAccess
import com.worksap.nlp.sudachi.dictionary.POS
import com.worksap.nlp.sudachi.dictionary.WordInfo
import java.net.URL

fun DictionaryAccess.setCharacterCategory(
Expand Down Expand Up @@ -50,15 +49,5 @@ fun DictionaryAccess.morpheme(id: Int): Morpheme {
return l[0]
}

val Morpheme.wordInfo: WordInfo
get() =
if (this is MorphemeImpl) {
this.wordInfo
} else if (this is SingleMorphemeImpl) {
this.wordInfo
} else {
throw IllegalStateException("Unknown subclass of Morpheme: ${this}")
}

val String.pos: POS
get() = POS(this.split(","))

0 comments on commit 1aa19ec

Please sign in to comment.