mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-04 18:39:33 +00:00
Merge pull request #1818 from eikek/estonian-language
Add Estonian language
This commit is contained in:
commit
a779d4342c
@ -33,6 +33,7 @@ RUN JDKPKG="openjdk11-jre"; \
|
||||
tesseract-ocr-data-heb \
|
||||
tesseract-ocr-data-lit \
|
||||
tesseract-ocr-data-pol \
|
||||
tesseract-ocr-data-est \
|
||||
unpaper \
|
||||
wkhtmltopdf \
|
||||
libreoffice \
|
||||
|
@ -110,6 +110,7 @@ object DateFind {
|
||||
case Language.Hebrew => dmy
|
||||
case Language.Lithuanian => ymd
|
||||
case Language.Polish => dmy
|
||||
case Language.Estonian => dmy
|
||||
}
|
||||
p.read(parts) match {
|
||||
case Result.Success(sds, _) =>
|
||||
|
@ -60,6 +60,8 @@ object MonthName {
|
||||
lithuanian
|
||||
case Language.Polish =>
|
||||
polish
|
||||
case Language.Estonian =>
|
||||
estonian
|
||||
}
|
||||
|
||||
private val numbers = List(
|
||||
@ -375,4 +377,19 @@ object MonthName {
|
||||
List("listopada", "lis"),
|
||||
List("grudnia", "gru")
|
||||
)
|
||||
|
||||
private val estonian = List(
|
||||
List("jaanuar", "jaan"),
|
||||
List("veebruar", "veebr"),
|
||||
List("märts"),
|
||||
List("aprill", "apr"),
|
||||
List("mai"),
|
||||
List("juuni"),
|
||||
List("juuli"),
|
||||
List("august", "aug"),
|
||||
List("september", "sept"),
|
||||
List("oktoober", "okt"),
|
||||
List("november", "nov"),
|
||||
List("detsember", "dets")
|
||||
)
|
||||
}
|
||||
|
@ -259,4 +259,32 @@ class DateFindTest extends FunSuite {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
test("find estonian dates") {
|
||||
assertEquals(
|
||||
DateFind
|
||||
.findDates(
|
||||
"Some text in estonian 21 juuli 2022 and stuff",
|
||||
Language.Estonian
|
||||
)
|
||||
.toVector,
|
||||
Vector(
|
||||
NerDateLabel(
|
||||
LocalDate.of(2022, 7, 21),
|
||||
NerLabel("21 juuli 2022", NerTag.Date, 22, 35)
|
||||
)
|
||||
)
|
||||
)
|
||||
assertEquals(
|
||||
DateFind
|
||||
.findDates("19.11.21", Language.Estonian)
|
||||
.toVector,
|
||||
Vector(
|
||||
NerDateLabel(
|
||||
LocalDate.of(2021, 11, 19),
|
||||
NerLabel("19.11.21", NerTag.Date, 0, 8)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,11 @@ object Language {
|
||||
val iso3 = "pol"
|
||||
}
|
||||
|
||||
case object Estonian extends Language {
|
||||
val iso2 = "et"
|
||||
val iso3 = "est"
|
||||
}
|
||||
|
||||
val all: List[Language] =
|
||||
List(
|
||||
German,
|
||||
@ -154,7 +159,8 @@ object Language {
|
||||
Japanese,
|
||||
Hebrew,
|
||||
Lithuanian,
|
||||
Polish
|
||||
Polish,
|
||||
Estonian
|
||||
)
|
||||
|
||||
def fromString(str: String): Either[String, Language] = {
|
||||
|
@ -204,5 +204,6 @@ object FtsRepository extends DoobieMeta {
|
||||
case Language.Hebrew => "simple"
|
||||
case Language.Lithuanian => "simple"
|
||||
case Language.Polish => "simple"
|
||||
case Language.Estonian => "simple"
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,12 @@ object SolrSetup {
|
||||
addContentField(Language.Polish)
|
||||
),
|
||||
SolrMigration.reIndexAll(26, "Re-Index after adding polish content field"),
|
||||
SolrMigration.reIndexAll(27, "Re-Index after collective-id change")
|
||||
SolrMigration.reIndexAll(27, "Re-Index after collective-id change"),
|
||||
SolrMigration[F](
|
||||
28,
|
||||
"Add Estonian",
|
||||
addContentField(Language.Estonian)
|
||||
)
|
||||
)
|
||||
|
||||
def addFolderField: F[Unit] =
|
||||
|
@ -34,6 +34,7 @@ type Language
|
||||
| Hungarian
|
||||
| Lithuanian
|
||||
| Polish
|
||||
| Estonian
|
||||
|
||||
|
||||
fromString : String -> Maybe Language
|
||||
@ -98,6 +99,9 @@ fromString str =
|
||||
else if str == "pol" || str == "pl" || str == "polish" then
|
||||
Just Polish
|
||||
|
||||
else if str == "est" || str == "et" || str == "estonian" then
|
||||
Just Estonian
|
||||
|
||||
else
|
||||
Nothing
|
||||
|
||||
@ -165,6 +169,9 @@ toIso3 lang =
|
||||
Polish ->
|
||||
"pol"
|
||||
|
||||
Estonian ->
|
||||
"est"
|
||||
|
||||
|
||||
all : List Language
|
||||
all =
|
||||
@ -188,4 +195,5 @@ all =
|
||||
, Hungarian
|
||||
, Lithuanian
|
||||
, Polish
|
||||
, Estonian
|
||||
]
|
||||
|
@ -77,6 +77,9 @@ gb lang =
|
||||
Polish ->
|
||||
"Polish"
|
||||
|
||||
Estonian ->
|
||||
"Estonian"
|
||||
|
||||
|
||||
de : Language -> String
|
||||
de lang =
|
||||
@ -141,6 +144,9 @@ de lang =
|
||||
Polish ->
|
||||
"Polnisch"
|
||||
|
||||
Estonian ->
|
||||
"Estnisch"
|
||||
|
||||
|
||||
fr : Language -> String
|
||||
fr lang =
|
||||
@ -204,3 +210,6 @@ fr lang =
|
||||
|
||||
Polish ->
|
||||
"Polonais"
|
||||
|
||||
Estonian ->
|
||||
"Estonien"
|
||||
|
Loading…
x
Reference in New Issue
Block a user