[Hejes-devel] [1671] relative path to resoures/

hejes-devel at nytud.hu hejes-devel at nytud.hu
Mon Oct 17 11:57:03 CEST 2016


Revision: 1671
Author:   mittelholcz
Date:     2016-10-17 11:57:02 +0200 (Mon, 17 Oct 2016)
Log Message:
-----------
relative path to resoures/

Modified Paths:
--------------
    trunk/web2py/applications/helyesiras_webdev/modules/egybekulon2.py

Modified: trunk/web2py/applications/helyesiras_webdev/modules/egybekulon2.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/modules/egybekulon2.py	2016-10-14 12:12:52 UTC (rev 1670)
+++ trunk/web2py/applications/helyesiras_webdev/modules/egybekulon2.py	2016-10-17 09:57:02 UTC (rev 1671)
@@ -14,6 +14,7 @@
 import sys
 sys.path.append('/opt/web2py')
 
+import os
 import re
 import xml.etree.ElementTree
 from gluon.contrib.pymysql import escape_string
@@ -75,9 +76,9 @@
        dbconn: a web2py DAL object, an existing open connection to the MySQL database holding the lexical data.
     """
     self.dbconn = dbconn
-    #with open('resources/egybekulon2_-_lagyszaruak') as file_:
-    #  self.literally_exceptions = set([ x.strip() for x in file_ ])
-    #  self.literally_exceptions = set([ unicode(x, 'utf8') for x in self.literally_exceptions if x and not x.startswith('#') ])
+    with open(os.path.dirname(os.path.realpath(__file__)) + '/resources/egybekulon2_-_lagyszaruak') as file_:
+      self.literally_exceptions = set([ x.strip() for x in file_ ])
+      self.literally_exceptions = set([ unicode(x, 'utf8') for x in self.literally_exceptions if x and not x.startswith('#') ])
     pass
     
   @staticmethod
@@ -232,6 +233,23 @@
     ret = []
     for head in self.last_token_stems:
       ret.append(''.join([t.tok for t in self.toklst.toks[:-1]]) + head)
+    #############################
+    # lagyszaruak
+    # TODO:
+    #   OK: a ragozott alakokra is mukodnie kellene (pl. 'lagyszaruaknak')
+    #   2. honnan jon a magyarazat? Azt is at kell irni, kulonben mas lesz a magyarazat, mint a javaslat.
+    #   OK: lehet, hogy nem kene minden result-ot atirni, ha tobb kulonbozo is van
+    ####
+    #if any([x in ''.join(self.usrtoks) for x in self.literally_exceptions]):
+    #  for res in result:
+    #    if ' ' in res.get('actual', ''):
+    #      res['actual'] = res['actual'].replace(' ', '')
+    ####
+    # print('norm form:')
+    # for i in ret:
+    #     print('\t'+i)
+    # return ['lágyszárúak', 'lágyszárúak']
+    ############################
     return ret
 
   def get_suffixated_forms(self, form=None):




More information about the Hejes-devel mailing list