Skip to content

Commit a54c949

Browse files
committed
moving around folders
1 parent 179cf1e commit a54c949

28 files changed

+134
-698
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Sean Bugeja
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Pipfile

-9
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,8 @@ name = "pypi"
77
tensorflow = "*"
88
matplotlib = "*"
99
spacy = "*"
10-
nltk = "*"
11-
spacymoji = "*"
1210

1311
[dev-packages]
14-
pylint = "*"
15-
rope = "*"
16-
"pep8" = "*"
17-
pycodestyle = "*"
18-
"autopep8" = "*"
19-
black = "*"
20-
pydocstyle = "*"
2112

2213
[requires]
2314
python_version = "3.6"

Pipfile.lock

-613
This file was deleted.

main.py

+60-60
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
import tensorflow as tf
22
from tensorflow.python import debug as tf_debug # pylint: disable=E0611
3-
from datasets.Dataset import Dataset, DATASETS
4-
from embeddings.Embedding import Embedding, EMBEDDINGS
5-
from models.Tang2016a.Lstm import Lstm
6-
from models.Tang2016a.TdLstm import TdLstm
7-
from models.Tang2016a.TcLstm import TcLstm
8-
from experiments.Experiment import Experiment
3+
from tsaplay.datasets.Dataset import Dataset, DATASETS
4+
from tsaplay.embeddings.Embedding import Embedding, EMBEDDINGS
5+
from tsaplay.models.Tang2016a.Lstm import Lstm
6+
from tsaplay.models.Tang2016a.TdLstm import TdLstm
7+
from tsaplay.models.Tang2016a.TcLstm import TcLstm
8+
from tsaplay.experiments.Experiment import Experiment
99

1010
tf.logging.set_verbosity(tf.logging.INFO)
1111

1212

1313
model = Lstm(run_config=tf.estimator.RunConfig(tf_random_seed=1234))
1414

15-
experiment = Experiment(
16-
dataset=Dataset(
17-
path=DATASETS.DONG2014_PATH,
18-
parser=DATASETS.DONG2014_PARSER,
19-
embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
20-
),
21-
model=model,
22-
)
23-
experiment.run(job="train+eval", steps=100)
24-
experiment = Experiment(
25-
dataset=Dataset(
26-
path=DATASETS.NAKOV2016_PATH,
27-
parser=DATASETS.NAKOV2016_PARSER,
28-
embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
29-
),
30-
model=model,
31-
)
32-
experiment.run(job="train+eval", steps=100)
33-
experiment = Experiment(
34-
dataset=Dataset(
35-
path=DATASETS.SAEIDI2016_PATH,
36-
parser=DATASETS.SAEIDI2016_PARSER,
37-
embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
38-
),
39-
model=model,
40-
)
41-
experiment.run(job="train+eval", steps=100)
42-
experiment = Experiment(
43-
dataset=Dataset(
44-
path=DATASETS.SAEIDI2016_PATH,
45-
parser=DATASETS.SAEIDI2016_PARSER,
46-
embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
47-
),
48-
model=model,
49-
)
50-
experiment.run(job="train+eval", steps=100)
51-
experiment = Experiment(
52-
dataset=Dataset(
53-
path=DATASETS.WANG2017_PATH,
54-
parser=DATASETS.WANG2017_PARSER,
55-
embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
56-
),
57-
model=model,
58-
)
59-
experiment.run(job="train+eval", steps=100)
60-
experiment = Experiment(
61-
dataset=Dataset(
62-
path=DATASETS.XUE2018_PATH,
63-
parser=DATASETS.XUE2018_PARSER,
64-
embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
65-
),
66-
model=model,
67-
)
68-
experiment.run(job="train+eval", steps=100)
15+
# experiment = Experiment(
16+
# dataset=Dataset(
17+
# path=DATASETS.DONG2014_PATH,
18+
# parser=DATASETS.DONG2014_PARSER,
19+
# embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
20+
# ),
21+
# model=model,
22+
# )
23+
# experiment.run(job="train+eval", steps=100)
24+
# experiment = Experiment(
25+
# dataset=Dataset(
26+
# path=DATASETS.NAKOV2016_PATH,
27+
# parser=DATASETS.NAKOV2016_PARSER,
28+
# embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
29+
# ),
30+
# model=model,
31+
# )
32+
# experiment.run(job="train+eval", steps=100)
33+
# experiment = Experiment(
34+
# dataset=Dataset(
35+
# path=DATASETS.SAEIDI2016_PATH,
36+
# parser=DATASETS.SAEIDI2016_PARSER,
37+
# embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
38+
# ),
39+
# model=model,
40+
# )
41+
# experiment.run(job="train+eval", steps=100)
42+
# experiment = Experiment(
43+
# dataset=Dataset(
44+
# path=DATASETS.SAEIDI2016_PATH,
45+
# parser=DATASETS.SAEIDI2016_PARSER,
46+
# embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
47+
# ),
48+
# model=model,
49+
# )
50+
# experiment.run(job="train+eval", steps=100)
51+
# experiment = Experiment(
52+
# dataset=Dataset(
53+
# path=DATASETS.WANG2017_PATH,
54+
# parser=DATASETS.WANG2017_PARSER,
55+
# embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
56+
# ),
57+
# model=model,
58+
# )
59+
# experiment.run(job="train+eval", steps=100)
60+
# experiment = Experiment(
61+
# dataset=Dataset(
62+
# path=DATASETS.XUE2018_PATH,
63+
# parser=DATASETS.XUE2018_PARSER,
64+
# embedding=Embedding(path=EMBEDDINGS.GLOVE_TWITTER_25D),
65+
# ),
66+
# model=model,
67+
# )
68+
# experiment.run(job="train+eval", steps=100)

tests/context.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import os
2+
import sys
3+
4+
sys.path.insert(
5+
0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
6+
)
7+
8+
import tsaplay # noqa

tests/utils_test.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import pytest
2+
3+
4+
def f():
5+
raise SystemExit(1)
6+
7+
8+
def test_mytest():
9+
with pytest.raises(SystemExit):
10+
f()

tox.ini

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# tox (https://tox.readthedocs.io/) is a tool for running tests
2+
# in multiple virtualenvs. This configuration file will run the
3+
# test suite on all supported python versions. To use it, "pip install tox"
4+
# and then run "tox" from this directory.
5+
6+
[tox]
7+
envlist = py36
8+
skipsdist = true
9+
10+
[pytest]
11+
testpaths =
12+
./tests
13+
14+
[testenv]
15+
deps =
16+
hypothesis
17+
pytest
18+
commands =
19+
pytest

__init__.py tsaplay/__init__.py

File renamed without changes.

datasets/Dataset.py tsaplay/datasets/Dataset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from os.path import normpath, basename, isfile, join, exists
44
from statistics import mean
55
from functools import wraps
6-
from utils import (
6+
from tsaplay.utils import (
77
token_filter,
88
re_dist,
99
inspect_dist,
@@ -17,7 +17,7 @@
1717
unpickle_file as _unpickle,
1818
pickle_file as _pickle,
1919
)
20-
import datasets._constants as DATASETS
20+
import tsaplay.datasets._constants as DATASETS
2121

2222

2323
class Dataset:
File renamed without changes.

datasets/_constants.py tsaplay/datasets/_constants.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from os import getcwd
22
from os.path import join
3-
import datasets._parsers as PARSERS
3+
import tsaplay.datasets._parsers as PARSERS
44

5-
__data = join(getcwd(), "datasets", "data")
5+
__data = join(getcwd(), "tsaplay", "datasets", "data")
66

77
DEBUG_PATH = join(__data, "debug_dataset")
88
DEBUG_PARSER = PARSERS.dong_parser
File renamed without changes.
File renamed without changes.

embeddings/Embedding.py tsaplay/embeddings/Embedding.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import numpy as np
22
import tensorflow as tf
33
from os.path import normpath, basename, splitext, dirname
4-
from utils import tokenize_phrase, default_oov
4+
from tsaplay.utils import tokenize_phrase, default_oov
55

6-
import embeddings._constants as EMBEDDINGS
6+
import tsaplay.embeddings._constants as EMBEDDINGS
77

88

99
class Embedding:
File renamed without changes.

embeddings/_constants.py tsaplay/embeddings/_constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from os import getcwd
22
from os.path import join
33

4-
__data = join(getcwd(), "embeddings", "data")
4+
__data = join(getcwd(), "tsaplay", "embeddings", "data")
55
__glove = join(__data, "GloVe")
66
__debug = join(__data, "debug_embedding")
77

File renamed without changes.

experiments/Experiment.py tsaplay/experiments/Experiment.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from os import getcwd
33
from os.path import join as _join, relpath, dirname, exists, abspath
44
from inspect import getfile
5-
from utils import start_tensorboard, write_stats_to_disk
5+
from tsaplay.utils import start_tensorboard, write_stats_to_disk
66

77

88
class Experiment:
@@ -57,7 +57,8 @@ def _init_exp_dir(self, model, dataset, contd_tag):
5757
all_exps_path = _join(dirname(abspath(__file__)), "data")
5858
rel_model_path = _join(
5959
relpath(
60-
dirname(getfile(model.__class__)), _join(getcwd(), "models")
60+
dirname(getfile(model.__class__)),
61+
_join(getcwd(), "tsaplay", "models"),
6162
),
6263
model.__class__.__name__,
6364
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

models/Tang2016a/LSTM.py tsaplay/models/Tang2016a/Lstm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import tensorflow as tf
2-
from models.Model import Model
3-
from models.Tang2016a.common import (
2+
from tsaplay.models.Model import Model
3+
from tsaplay.models.Tang2016a.common import (
44
params as default_params,
55
dropout_lstm_cell,
66
lstm_input_fn,

models/Tang2016a/TCLSTM.py tsaplay/models/Tang2016a/TcLstm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import tensorflow as tf
2-
from models.Model import Model
3-
from models.Tang2016a.common import (
2+
from tsaplay.models.Model import Model
3+
from tsaplay.models.Tang2016a.common import (
44
params as default_params,
55
dropout_lstm_cell,
66
tclstm_input_fn,

models/Tang2016a/TDLSTM.py tsaplay/models/Tang2016a/TdLstm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import tensorflow as tf
2-
from models.Model import Model
3-
from models.Tang2016a.common import (
2+
from tsaplay.models.Model import Model
3+
from tsaplay.models.Tang2016a.common import (
44
params as default_params,
55
dropout_lstm_cell,
66
tdlstm_input_fn,
File renamed without changes.
File renamed without changes.
File renamed without changes.

utils.py tsaplay/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import spacy
2-
import nltk
32
import numpy as np
43
import tensorflow as tf
54
from random import choice, randrange

0 commit comments

Comments
 (0)