|
Revision 98, 1.1 kB
(checked in by njohri2, 3 years ago)
|
Added MontyLemmatiser and required files. SABBrain now uses it
|
| Line | |
|---|
| 1 |
__author__="Hugo Liu <hugo@media.mit.edu>" |
|---|
| 2 |
__version__="2.0" |
|---|
| 3 |
import os,string,sys |
|---|
| 4 |
|
|---|
| 5 |
class MontyUtils: |
|---|
| 6 |
|
|---|
| 7 |
def __init__(self): |
|---|
| 8 |
pass |
|---|
| 9 |
|
|---|
| 10 |
def find_file(self,filename): |
|---|
| 11 |
|
|---|
| 12 |
if filename in os.listdir('.'): |
|---|
| 13 |
return './'+filename |
|---|
| 14 |
|
|---|
| 15 |
if os.environ.has_key('MONTYLINGUA'): |
|---|
| 16 |
csplits=os.environ['MONTYLINGUA'].split(';') |
|---|
| 17 |
csplits=map(lambda groupss:groupss.strip(),csplits) |
|---|
| 18 |
|
|---|
| 19 |
for enabled_arr in csplits: |
|---|
| 20 |
|
|---|
| 21 |
try : |
|---|
| 22 |
|
|---|
| 23 |
if filename in os.listdir(enabled_arr): |
|---|
| 24 |
return enabled_arr+'/'+filename |
|---|
| 25 |
except : |
|---|
| 26 |
pass |
|---|
| 27 |
|
|---|
| 28 |
if os.environ.has_key('PATH'): |
|---|
| 29 |
csplits=os.environ['PATH'].split(';') |
|---|
| 30 |
csplits=map(lambda groupss:groupss.strip(),csplits) |
|---|
| 31 |
|
|---|
| 32 |
for enabled_arr in csplits: |
|---|
| 33 |
|
|---|
| 34 |
try : |
|---|
| 35 |
|
|---|
| 36 |
if filename in os.listdir(enabled_arr): |
|---|
| 37 |
return enabled_arr+'/'+filename |
|---|
| 38 |
except : |
|---|
| 39 |
pass |
|---|
| 40 |
return '' |
|---|