diff --git a/core/src/main/resources/templatetransform.json b/core/src/main/resources/templatetransform.json index fce2421f03..fe37925aaa 100644 --- a/core/src/main/resources/templatetransform.json +++ b/core/src/main/resources/templatetransform.json @@ -30,7 +30,31 @@ }, "Lang":{ "transformer":"textNode", - "replace": "
$(3||)
" + "replace": "$(2||)" + }, + "Native name|native_name":{ + "transformer":"textNode", + "replace": "$(2||)" + }, + "Nihongo2":{ + "transformer":"textNode", + "replace": "$(1||)" + }, + "Nihongo":{ + "transformer":"textNode", + "replace": "$(2||)" + }, + "Langx":{ + "transformer":"textNode", + "replace": "$(2||)" + }, + "Script":{ + "transformer":"textNode", + "replace": "$(2||)" + }, + "Transliteration":{ + "transformer":"textNode", + "replace": "$(2||)" }, "Marriage":{ "transformer":"extractChildren", diff --git a/core/src/test/scala/org/dbpedia/extraction/wikiparser/TemplateTransformParserTest.scala b/core/src/test/scala/org/dbpedia/extraction/wikiparser/TemplateTransformParserTest.scala index af95a30f41..a39ec01d57 100644 --- a/core/src/test/scala/org/dbpedia/extraction/wikiparser/TemplateTransformParserTest.scala +++ b/core/src/test/scala/org/dbpedia/extraction/wikiparser/TemplateTransformParserTest.scala @@ -53,6 +53,41 @@ class TemplateTransformParserTest extends FlatSpec with Matchers parse("en", "{{url|https://www.dji.com DJI.com}}") should be (Some("[https://www.dji.com]")) } + it should "extract text from {{lang|nap|Abbrùzzu}}" in + { + parse("en", "{{lang|nap|Abbrùzzu}}") should be (Some("Abbrùzzu")) + } + + it should "extract text from {{native name|nap|Abbrùzze}}" in + { + parse("en", "{{native name|nap|Abbrùzze}}") should be (Some("Abbrùzze")) + } + + it should "extract text from {{Nihongo2|東京都}}" in + { + parse("en", "{{Nihongo2|東京都}}") should be (Some("東京都")) + } + + it should "extract text from {{Nihongo|Tokyo|東京|Tōkyō}}" in + { + parse("en", "{{Nihongo|Tokyo|東京|Tōkyō}}") should be (Some("東京")) + } + + it should "extract text from {{Script|Arab|أبجدية عربية}}" in + { + parse("en", "{{Script|Arab|أبجدية عربية}}") should be (Some("أبجدية عربية")) + } + + it should "extract text from {{Transliteration|ru|Moskva}}" in + { + parse("en", "{{Transliteration|ru|Moskva}}") should be (Some("Moskva")) + } + + it should "extract text from {{Langx|ja|東京}}" in + { + parse("en", "{{Langx|ja|東京}}") should be (Some("東京")) + } + private val wikiParser = WikiParser.getInstance()