spencermountain / wtf_wikipedia

a pretty-committed wikipedia markup parser
https://observablehq.com/@spencermountain/wtf_wikipedia
MIT License
770 stars 129 forks source link

Incomplete or Inaccurate text extraction from Wikipedia PT-BR #532

Closed andremacola closed 1 year ago

andremacola commented 1 year ago

Both doc.text() and doc.sentences() either cut essential parts of the text or retain some of the wikitext, mainly at the beginning of the content.

Example: https://pt.wikipedia.org/wiki/In_Time

doc.text() returns:

{{Info/Filme
|nome                 = In Time
|título-prt            = Sem Tempo
|título-bra            = O Preço do Amanhã
|imagem               = In Time.jpg
|legenda              = Pôster original do filme.
|tamanho_imagem       = 220px
|país                 = {{EUA}}
|ano                  = 2011

In the case of the article https://pt.wikipedia.org/wiki/Camiseta

doc.text() returns truncated, starting with a comma:

, é uma pequena camisa, de mangas curtas ou sem mangas, geralmente em malha de algodão, e mais recentemente em vários outros materiais, tais como poliéster. Trata-se de um elemento do vestuário, que na contemporaneidade é utilizada pelas empresas de moda para estampar imagens e frases chamativas.
spencermountain commented 1 year ago

first one was an unmatched bracket in the wikipedia page. i just edited the page to fix it -

let str = ` {{Info/Filme
|nome                  = In Time
|título-prt             = Sem Tempo
|distribuição          = [[20th Century Fox]]
|lançamento            = 
|website               = http://www.intimemovie.com}
}}
foobar oh yeah
`
let doc = wtf(str)
console.log(doc.text())

second one was the missing pbpe template added it. thanks

spencermountain commented 1 year ago

bouth should work now in 10.1.5