Subversion Repositories navi

Compare Revisions

Ignore whitespace Rev 270 → Rev 281

/webapp/templates/index.html
28,4 → 28,5
<a href="/number"><b>Number translator</b></a> - this webapp allows you to translate written-out Na'vi numbers into decimal and octal.<br />
<a href="/parse"><b>Parser</b></a> - this webapp can parse Na'vi sentences into the base words, prefixes, infixes and suffixes. It does not translate the words.<br />
<a href="/translate"><b>Translator</b></a> - this webapp translates full Na'vi sentences into human languages, as well as any affixes into the technical abbreviations.
<a href="svn://tim32.org/navi">SVN repository</a> <a href="http://websvn.tim32.org/listing.php?repname=navi">(websvn)</a>
{% end %}
/tsimapiak/parse.py
28,8 → 28,8
wordlist = dbconnector.getnavilist()
 
 
BROKENWORDS = ((u"sami", u"si", u"", u"am", u"", (()), (()), False), (u"to", u"to", u"", u"", u"", (()), (()), False), (u"frato", u"to", u"", u"", u"", [[u"fra"]], (()), False), (u"mengenga", u"ngenga", u"", u"", u"", [[u"me"]], (()), False), (u"pxengenga", u"ngenga", u"", u"", u"", [[u"pxe"]], (()), False), (u"kìmä", u"kä", u"", u"ìm", u"", (()), (()), False), (u"apxay", u"pxay", u"", u"", u"", [[u"a"]], (()), False), (u"akawng", u"kawng", u"", u"", u"", [[u"a"]], (()), False))
# XXX HACK - These are words that are either not in Eana Eltu, or that get interpreted wrongly for whatever reason. The latter should be removed from this list when the parser gets more sophisticated. The former should also have an entry in the equivalent array in the translator! If it can take infixes, consider adding it to the main wordlist above (see the examples). The order is - original, Na'vi root, 0-pos infix, 1-pos infix, 2-pos infix, PREFIXES, suffixes. Things that can take affixes should go in the above list instead.
BROKENWORDS = ((u"sami", u"si", u"", u"am", u"", (()), (()), False), (u"to", u"to", u"", u"", u"", (()), (()), False), (u"frato", u"to", u"", u"", u"", [[u"fra"]], (()), False), (u"soaiä", u"soaia", u"", u"", u"", (()), [[u"ä"]], False), (u"mengenga", u"ngenga", u"", u"", u"", [[u"me"]], (()), False), (u"pxengenga", u"ngenga", u"", u"", u"", [[u"pxe"]], (()), False), (u"kìmä", u"kä", u"", u"ìm", u"", (()), (()), False), (u"apxay", u"pxay", u"", u"", u"", [[u"a"]], (()), False), (u"akawng", u"kawng", u"", u"", u"", [[u"a"]], (()), False), (u"kawnga", u"kawng", u"", u"", u"", (()), [[u"a"]], False), (u"kawng", u"kawng", u"", u"", u"", (()), (()), False), (u"ka", u"ka", u"", u"", u"", (()), (()), False), (u"uo", u"uo", u"", u"", u"", (()), (()), False), (u"sìk", u"sìk", u"", u"", u"", (()), (()), False), (u"sim", u"sim", u"", u"", u"", (()), (()), False)) # probably not tsim lenited
# XXX HACK - These are words that are either not in Eana Eltu, or that get interpreted wrongly for whatever reason. The latter should be removed from this list when the parser gets more sophisticated. The former should also have an entry in the equivalent array in the translator! If it can take infixes, consider adding it to the main wordlist above (see the examples). The order is - original, Na'vi root, 0-pos infix, 1-pos infix, 2-pos infix, prefixes, suffixes. Things that can take affixes should go in the above list instead.
INFIXES1 = (u"awn", u"eyk", u"us", u"äp", u"")
INFIXES2 = (u"ìyev", u"iyev", u"ìmìy", u"arm", u"asy", u"ilv", u"ìmv", u"imv", u"ìrm", u"irv", u"ìsy", u"aly", u"ary", u"ìly", u"ìry", u"ìlm", u"alm", u"am", u"ay", u"er", u"ìm", u"iv", u"ìy", u"ol", u"")
INFIXES3 = (u"äng", u"ats", u"eiy", u"ei", u"uy", u"")
109,6 → 109,10
temp = splitword[wor][:-3] + u"ng"
if temp in wordin[wor]:
center = temp
if splitword[wor].endswith(u"fo"):
temp = splitword[wor][:-2] + u"f"
if temp in wordin[wor]:
center = temp
if splitword[wor].endswith(u"po"):
temp = splitword[wor][:-2] + u"p"
if temp in wordin[wor]:
/tsimapiak/dbconnector.py
29,7 → 29,7
for row in db.query("""
SELECT *
FROM `metaWords`
WHERE partOfSpeech <> 'num.' AND partOfSpeech <> 'prefix'
WHERE partOfSpeech <> 'num.' AND partOfSpeech <> 'prefix' AND partOfSpeech <> 'affix'
ORDER BY CHAR_LENGTH(navi) DESC"""):
if row["infixes"]:
ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"].lower(), "type": row["partOfSpeech"]})
/ircbot/ircbot.py
File deleted
/ircbot/irclib.py
File deleted
/ircbot/bot.py
19,9 → 19,10
# You should have received a copy of the GNU General Public License
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>.#
 
from ircbot import SingleServerIRCBot
from irclib import nm_to_n
from irc.bot import SingleServerIRCBot
from irc.client import nm_to_n
from tsimapiak import translate
from threading import *
 
class Bot(SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667):
28,6 → 29,11
SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
self.channel = channel
 
def pingit(self, c):
c.ping("testing")
t = Timer(30, self.pingit, [c])
t.start()
 
def on_nicknameinuse(self, c, e):
c.nick(c.get_nickname() + "_")
 
34,6 → 40,8
def on_welcome(self, c, e):
c.join(self.channel)
c.privmsg("NiceBot", "asztallab")
t = Timer(30, self.pingit, [c])
t.start()
 
def on_privmsg(self, c, e):
self.do_command(e, e.arguments()[0], True)
45,10 → 53,10
return
 
def do_command(self, e, cmd, priv):
try:
cmd = cmd.decode("utf-8")
except:
cmd = cmd.decode("iso-8859-1")
# try:
# cmd = cmd.decode("utf-8")
# except:
# cmd = cmd.decode("iso-8859-1")
if priv:
nick = nm_to_n(e.source())
else:
67,11 → 75,11
for word in translate.translatesent(sent, lang):
translated.append(word["translated"])
translated = nm_to_n(e.source()) + ": " + " | ".join(translated)
c.privmsg(nick, translated.encode("utf-8"))
c.privmsg(nick, translated)
 
def main():
#bot = Bot("#tim32", "TsimApiak", "irc.tim32.org", 6667)
bot = Bot("#na'vi", "TsimApiak", "irc.learnnavi.org", 6667)
bot = Bot("#na'vi", "TsimApiak", "ikranakel.learnnavi.org", 6667)
bot.start()
 
if __name__ == "__main__":