forked from linuxscout/arabicstopwords
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
103 lines (91 loc) · 2.94 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#/usr/bin/sh
# Build Arabic stop word list files
DATA_DIR :=data/classified
RELEASES :=releases
BUILD :=$(RELEASES)/build
OUTPUT :=tests/output
SCRIPT :=scripts
VERSION=0.6
DOC="."
FORMAT:=csv
default: all
# Clean build files
clean:
rm -f -r $(RELEASES)/*
backup:
mkdir -p $(RELEASES)/backup$(VERSION)
#~ mv $(RELEASES)/*.bz2 $(RELEASES)/backup$(VERSION)
#create all files
all: ods release
# Publish to github
publish:
git push origin master
ods:
#Generate csv files from ODS
libreoffice --headless --convert-to "csv:Text - txt - csv (StarCalc):9,34,UTF8" --outdir $(OUTPUT)/ $(DATA_DIR)/stopwords.ods
#Package files
release: backup format pack
format:py sql csv
py: FORMAT:=py
sql: FORMAT:=sql
csv: FORMAT:=csv
py sql csv:
#Generate Specific format CSV SQL and python
echo " Generate ${FORMAT} version"
# all forms
python $(SCRIPT)/generate_stopwords_format.py -v $(VERSION) -a -f $(OUTPUT)/stopwords.csv -o ${FORMAT} >$(OUTPUT)/stopwordsallforms.${FORMAT}
# classified
python $(SCRIPT)/generate_stopwords_format.py -v $(VERSION) -f $(OUTPUT)/stopwords.csv -o ${FORMAT} > $(OUTPUT)/stopwords_classified.${FORMAT}
#packaging
pack:
#doc
mkdir -p $(BUILD)
cp -f $(DOC)/README.md $(BUILD)
cp -f $(DOC)/LICENSE $(BUILD)
cp -f $(DOC)/AUTHORS $(BUILD)
#~ #classified
#~ mkdir -p $(BUILD)/classified
#~ cp -f $(OUTPUT)/stopwords.csv $(BUILD)/classified/
#python
mkdir -p $(BUILD)/python/stopwords
cp $(OUTPUT)/stopwordsallforms.py $(BUILD)/python/stopwords
cp $(OUTPUT)/stopwords_classified.py $(BUILD)/python/stopwords
cp $(OUTPUT)/stopwordsallforms.py python_lib/arabicstopwords
cp $(OUTPUT)/stopwords_classified.py python_lib/arabicstopwords
# sql
mkdir -p $(BUILD)/sql
cp -f $(OUTPUT)/stopwordsallforms.sql $(BUILD)/sql/
cp -f $(OUTPUT)/stopwords_classified.sql $(BUILD)/sql/
# csv
mkdir -p $(BUILD)/csv
cp -f $(OUTPUT)/stopwordsallforms.csv $(BUILD)/csv/
cp -f $(OUTPUT)/stopwords_classified.csv $(BUILD)/csv/
#zip
cd $(BUILD) && tar cfj arabicstopwords.$(VERSION).tar.bz2 *
mv $(BUILD)/arabicstopwords.$(VERSION).tar.bz2 $(RELEASES)/
sqlite:
mkdir -p $(BUILD)/sqlite
sqlite3 $(BUILD)/sqlite/database.sqlite < $(OUTPUT)/stopwordsallforms.sql
sqlite3 $(BUILD)/sqlite/database.sqlite < $(OUTPUT)/stopwords_classified.sql
# create indexes
sqlite3 $(BUILD)/sqlite/database.sqlite "CREATE INDEX idx_voc ON stopwords (unvocalized);"
sqlite3 $(BUILD)/sqlite/database.sqlite "CREATE INDEX idx_voc_class ON classedstopwords (word);"
install:
# install arabicstopwords library
cd python_lib;python setup.py install
publish:
git push origin master
wheel:
cd python_lib;sudo python setup.py bdist_wheel
wheel3:
cd python_lib;sudo python3 setup.py bdist_wheel
install:
cd python_lib;sudo python setup.py install
install3:
cd python_lib;sudo python3 setup.py install
sdist:
cd python_lib;sudo python setup.py sdist
upload:
echo "use twine upload dist/arabicstopwords-0.6-py2-none-any.whl"
test:
python python_lib/arabicstopwords/arabicstopwords.py