User:Jimregan: Difference between revisions
From DBpedia Mappings
Jump to navigationJump to search
m (add a slight introduction, fix the overuse of 'do' in Anja's warning.) |
m (pre, not nowiki) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<pre> | <pre> | ||
import net.sourceforge.jwbf.bots.MediaWikiBot | |||
import net.sourceforge.jwbf.contentRep.Article | |||
import scala.io.Source._ | |||
val m = new MediaWikiBot("http://mappings.dbpedia.org/") | |||
m.login("Username", "password") | |||
val links = fromFile("/tmp/articles", "utf-8").getLines | |||
links.foreach { | |||
first => { | |||
val art = new Article(m.readContent(first), m) | |||
art.setText(art.getText.replaceAll(" twinCity ", " twinTown ")) | |||
art.setMinorEdit(true) | |||
art.setEditSummary("s/twinCity/twinTown/") | |||
art.save | |||
} | |||
} | |||
</pre> | |||
Latest revision as of 15:54, 6 April 2015
import net.sourceforge.jwbf.bots.MediaWikiBot import net.sourceforge.jwbf.contentRep.Article import scala.io.Source._ val m = new MediaWikiBot("http://mappings.dbpedia.org/") m.login("Username", "password") val links = fromFile("/tmp/articles", "utf-8").getLines links.foreach { first => { val art = new Article(m.readContent(first), m) art.setText(art.getText.replaceAll(" twinCity ", " twinTown ")) art.setMinorEdit(true) art.setEditSummary("s/twinCity/twinTown/") art.save } }