Skip to content

Commit 70fbc63

Browse files
Fix template text extraction for lang, native name, and Nihongo templates
1 parent 339a568 commit 70fbc63

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

core/src/main/resources/templatetransform.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,19 @@
3030
},
3131
"Lang":{
3232
"transformer":"textNode",
33-
"replace": "<br />$(3||)<br />"
33+
"replace": "$(2||)"
34+
},
35+
"Native name|native_name":{
36+
"transformer":"textNode",
37+
"replace": "$(2||)"
38+
},
39+
"Nihongo2":{
40+
"transformer":"textNode",
41+
"replace": "$(1||)"
42+
},
43+
"Nihongo":{
44+
"transformer":"textNode",
45+
"replace": "$(2||)"
3446
},
3547
"Marriage":{
3648
"transformer":"extractChildren",

core/src/test/scala/org/dbpedia/extraction/wikiparser/TemplateTransformParserTest.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ class TemplateTransformParserTest extends FlatSpec with Matchers
5353
parse("en", "{{url|https://www.dji.com DJI.com}}") should be (Some("[https://www.dji.com]"))
5454
}
5555

56+
it should "extract text from {{lang|nap|Abbrùzzu}}" in
57+
{
58+
parse("en", "{{lang|nap|Abbrùzzu}}") should be (Some("Abbrùzzu"))
59+
}
60+
61+
it should "extract text from {{native name|nap|Abbrùzze}}" in
62+
{
63+
parse("en", "{{native name|nap|Abbrùzze}}") should be (Some("Abbrùzze"))
64+
}
65+
66+
it should "extract text from {{Nihongo2|東京都}}" in
67+
{
68+
parse("en", "{{Nihongo2|東京都}}") should be (Some("東京都"))
69+
}
70+
71+
it should "extract text from {{Nihongo|Tokyo|東京|Tōkyō}}" in
72+
{
73+
parse("en", "{{Nihongo|Tokyo|東京|Tōkyō}}") should be (Some("東京"))
74+
}
75+
5676

5777
private val wikiParser = WikiParser.getInstance()
5878

0 commit comments

Comments
 (0)