File tree Expand file tree Collapse file tree 3 files changed +30
-7
lines changed
src/main/kotlin/com/github/pemistahl/lingua Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ import com.github.pemistahl.lingua.api.Language.UNKNOWN
59
59
import com.github.pemistahl.lingua.api.Language.VIETNAMESE
60
60
import com.github.pemistahl.lingua.api.Language.YORUBA
61
61
import com.github.pemistahl.lingua.internal.Alphabet
62
+ import com.github.pemistahl.lingua.internal.Constant.MULTIPLE_WHITESPACE
63
+ import com.github.pemistahl.lingua.internal.Constant.NUMBERS
64
+ import com.github.pemistahl.lingua.internal.Constant.PUNCTUATION
62
65
import com.github.pemistahl.lingua.internal.Ngram
63
66
import com.github.pemistahl.lingua.internal.TestDataLanguageModel
64
67
import com.github.pemistahl.lingua.internal.TrainingDataLanguageModel
@@ -416,9 +419,6 @@ class LanguageDetector internal constructor(
416
419
417
420
internal companion object {
418
421
private val NO_LETTER = Regex (" ^[^\\ p{L}]+$" )
419
- private val PUNCTUATION = Regex (" \\ p{P}" )
420
- private val NUMBERS = Regex (" \\ p{N}" )
421
- private val MULTIPLE_WHITESPACE = Regex (" \\ s+" )
422
422
private val JAPANESE_CHARACTER_SET = try {
423
423
Regex (" ^[\\ p{Hiragana}\\ p{Katakana}\\ p{Han}]+$" )
424
424
} catch (e: PatternSyntaxException ) {
Original file line number Diff line number Diff line change 17
17
package com.github.pemistahl.lingua.api.io
18
18
19
19
import com.github.pemistahl.lingua.api.Language
20
+ import com.github.pemistahl.lingua.internal.Constant.MULTIPLE_WHITESPACE
21
+ import com.github.pemistahl.lingua.internal.Constant.NUMBERS
22
+ import com.github.pemistahl.lingua.internal.Constant.PUNCTUATION
20
23
import com.github.pemistahl.lingua.internal.io.FilesWriter
21
24
import java.nio.charset.Charset
22
25
import java.nio.file.Files
23
26
import java.nio.file.Path
24
27
25
28
object TestDataFilesWriter : FilesWriter() {
26
29
27
- private val PUNCTUATION = Regex (" \\ p{P}" )
28
- private val NUMBERS = Regex (" \\ p{N}" )
29
- private val MULTIPLE_WHITESPACE = Regex (" \\ s+" )
30
-
31
30
/* *
32
31
* Creates test data files for accuracy report generation and writes them to a directory.
33
32
*
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright © 2018-2020 Peter M. Stahl pemistahl@gmail.com
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.github.pemistahl.lingua.internal
18
+
19
+ internal object Constant {
20
+
21
+ val PUNCTUATION = Regex (" \\ p{P}" )
22
+ val NUMBERS = Regex (" \\ p{N}" )
23
+ val MULTIPLE_WHITESPACE = Regex (" \\ s+" )
24
+ }
You can’t perform that action at this time.
0 commit comments