From 879ca38a3399a022edc531d32318ad16e37af7a1 Mon Sep 17 00:00:00 2001 From: Profir-Petru Partachi Date: Tue, 21 Jan 2020 15:43:24 +0000 Subject: [PATCH] Make src an explicit module (solves relative import issues) --- README.MD | 3 +++ src/RPC_serve.py | 6 +++--- src/evaluate.py | 8 ++++---- src/process.py | 6 +++--- src/process_pairs.py | 6 +++--- src/tagger/config.py | 2 +- src/train.py | 6 +++--- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/README.MD b/README.MD index 16ccd42..7377ac9 100644 --- a/README.MD +++ b/README.MD @@ -1,4 +1,7 @@ # POSIT +[![DOI](https://zenodo.org/badge/233908281.svg)](https://zenodo.org/badge/latestdoi/233908281) + + This a project to simultaneously provide language ID tags and Part-Of-Speech or compiler tags (which are taken from CLANG compilations of C and C++ code). diff --git a/src/RPC_serve.py b/src/RPC_serve.py index c9e09e2..4a9ad4b 100644 --- a/src/RPC_serve.py +++ b/src/RPC_serve.py @@ -5,9 +5,9 @@ def main(): from nltk import casual_tokenize - from .preprocessor.preprocess import CODE_TOKENISATION_REGEX - from .tagger.config import Configuration - from .evaluate import restore_model + from src.preprocessor.preprocess import CODE_TOKENISATION_REGEX + from src.tagger.config import Configuration + from src.evaluate import restore_model from xmlrpc.server import SimpleXMLRPCServer from xmlrpc.server import SimpleXMLRPCRequestHandler diff --git a/src/evaluate.py b/src/evaluate.py index a374a21..c6057f5 100644 --- a/src/evaluate.py +++ b/src/evaluate.py @@ -5,10 +5,10 @@ from nltk import casual_tokenize -from .preprocessor.preprocess import CODE_TOKENISATION_REGEX -from .tagger.config import Configuration -from .tagger.data_utils import CorpusIterator -from .tagger.model import CodePoSModel +from src.preprocessor.preprocess import CODE_TOKENISATION_REGEX +from src.tagger.config import Configuration +from src.tagger.data_utils import CorpusIterator +from src.tagger.model import CodePoSModel def interactive_shell(model, casual=False): diff --git a/src/process.py b/src/process.py index 5b704dc..5828f6d 100644 --- a/src/process.py +++ b/src/process.py @@ -1,8 +1,8 @@ import sys -from .preprocessor.preprocess import tokenise_SO, tokenise_lkml -from .tagger.config import Configuration -from .tagger.model import CodePoSModel +from src.preprocessor.preprocess import tokenise_SO, tokenise_lkml +from src.tagger.config import Configuration +from src.tagger.model import CodePoSModel def process_data(model, target_data, stackoverflow=False): diff --git a/src/process_pairs.py b/src/process_pairs.py index 4d596b3..4f5843f 100644 --- a/src/process_pairs.py +++ b/src/process_pairs.py @@ -1,9 +1,9 @@ import os import sys -from .preprocessor.preprocess import tokenize_SO_row -from .tagger.config import Configuration -from .tagger.model import CodePoSModel +from src.preprocessor.preprocess import tokenize_SO_row +from src.tagger.config import Configuration +from src.tagger.model import CodePoSModel def process_one_rev(model, target_data, rev, post_id): diff --git a/src/tagger/config.py b/src/tagger/config.py index 85c8c14..5b94e7b 100644 --- a/src/tagger/config.py +++ b/src/tagger/config.py @@ -44,7 +44,7 @@ def load(self): # general config with_l_id = True - project = "SO_Freq" + project = "SO_n_Lucid" project += '_Id' if with_l_id else '' # project += '5' # embeddings diff --git a/src/train.py b/src/train.py index 42794b0..708a344 100644 --- a/src/train.py +++ b/src/train.py @@ -1,9 +1,9 @@ import json import os -from .tagger.config import Configuration -from .tagger.data_utils import CorpusIterator -from .tagger.model import CodePoSModel +from src.tagger.config import Configuration +from src.tagger.data_utils import CorpusIterator +from src.tagger.model import CodePoSModel def main():