This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function love.load() | |
-- Load our repeating texture | |
local img = love.graphics.newImage("dirt.png") | |
-- Points for our polygon | |
local vertices = {12,0, 396,7, 500,375, 195,520, 78,377} | |
texturedPoly = newTexturedPoly(vertices, img) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Iterate through pre-parsed KNP output stored in a file. Useful for processing a batch of | |
# sentences offline, and then dealing with them later. | |
use strict; | |
use warnings; | |
use KNP::File; | |
# File is the result of "juman | knp -tab > knp.out" | |
my $knp_file = new KNP::File( file => $ARGV[0], encoding => 'utf-8' ) | |
or die "Couldn't make KNP from file $!"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mwlib.refine import compat | |
raw = """ | |
=Sup= | |
Je suis le voyageur dans le baked beans. | |
""" | |
parsed = compat.parse_txt(raw) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mwlib.refine import compat,core | |
from mwlib.parser import nodes | |
import pprint | |
def main(): | |
pp = pprint.PrettyPrinter(indent=2) | |
raw = """ | |
=Cake= | |
Modern cake, especially layer cakes, normally contain a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<entry> | |
<ent_seq>1000220</ent_seq> | |
<k_ele> | |
<keb>明白</keb> | |
<ke_pri>ichi1</ke_pri> | |
<ke_pri>news1</ke_pri> | |
<ke_pri>nf10</ke_pri> | |
</k_ele> | |
<r_ele> | |
<reb>めいはく</reb> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/perl | |
use strict; | |
use warnings; | |
use XML::LibXML; | |
use encoding "utf-8"; | |
my $file = $ARGV[0]; | |
my $parser = XML::LibXML->new(); | |
my $doc = $parser->parse_file($file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print the entire tree of a Wiki article using mwlib | |
from mwlib import wiki | |
from mwlib.parser import nodes | |
def print_tree(node, indent): | |
tabs = indent * " " | |
print tabs + node.__class__.__name__ | |
indent += 1 | |
for child in node.children: | |
print_tree(child, indent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mwlib import wiki | |
from mwlib.parser import nodes | |
env = wiki.makewiki('/home/ben/wiki/simple/wikiconf.txt') # wiki Environment object | |
a = env.wiki.getParsedArticle('cheese') | |
for child in a.allchildren(): | |
if isinstance(child, nodes.Section): # Yay global function | |
print "Section title: " + child.children[0].asText() | |
if isinstance(child, nodes.LangLink): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<root> | |
<list> | |
<item> | |
<name>Magical stuff</name> | |
<identifier>private.magical</identifier> | |
<!-- Need this explicitly, otherwise the forward delete thing doesn't work --> | |
<autogen> | |
--KeyToKey-- | |
KeyCode::SEMICOLON, ModifierFlag::NONE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "NICT-ATR" : { "A" : { "adequacy" : 3, "fluency" : 4 }, "B" : { "adequacy" : 3, "fluency" : 3 }, "C" : { "adequacy" : 4, "fluency" : 2 }, "output" : "図12を参照して、本発明の第三実施例に説明説明次に、。" }, "NTT" : { "A" : { "adequacy" : 5, "fluency" : 5 }, "B" : { "adequacy" : 5, "fluency" : 5 }, "C" : { "adequacy" : 5, "fluency" : 5 }, "output" : "次に、 図 12 を参照して、 本発明の第 3 の実施例について説明する。" }, "_id" : { "$oid" : "4ed3428a7f7130fdf093a41d" }, "english" : "Next, explanation will be given on a third embodiment of the present invention, by referring to FIG. 12.", "id" : "20000523-155948-EMBODIMENTS-73", "kuro" : { "A" : { "adequacy" : 5, "fluency" : 5 }, "B" : { "adequacy" : 5, "fluency" : 5 }, "C" : { "adequacy" : 5, "fluency" : 5 }, "output" : "次に、本発明の第3の実施例について12図である参照して説明する。" }, "moses" : { "A" : { "adequacy" : 5, "fluency" : 5 }, "B" : { "adequacy" : 5, "fluency" : 5 }, "C" : { "adequacy" : 5, "fluency" : 5 }, "output" : "次に 、 図 12 を 参照 し て 、 本 発明 の 第 3 実施 例 について 説明 する 。 " }, "ref" : "次に、本発明の第3実施例を図12用いて説明する。", "tsbmt" : { "A" : { "a |