-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweets_process.sh
executable file
·34 lines (26 loc) · 1.27 KB
/
tweets_process.sh
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
#!/bin/sh
# en premier lieu spécifier le chemin vers le dossier du projets
# dans la variable POETRY_TWEETSMODELING_STORAGE_ROOT_PATH
# $ export POETRY_TWEETSMODELING_STORAGE_ROOT_PATH="path/to/project/dir"
# récupérer la variable POETRY_TWEETSMODELING_STORAGE_ROOT_PATH si la variable existe
PROJECT_DIR=${POETRY_TWEETSMODELING_PROJECT_ROOT_PATH:-1}
# repertoire où stocker les tweets.
# Si inexistant, alors le créer
TWEETS_STORAGE_DIR="${PROJECT_DIR}/tweets_storage"
[ ! -d "$TWEETS_STORAGE_DIR" ] && mkdir -p "$TWEETS_STORAGE_DIR" # create dir if it doesn't exist
# scripts_dir="$PROJECT_DIR/tweets_manager"
data_dir="$TWEETS_STORAGE_DIR/data"
#logs_dir="$TWEETS_STORAGE_DIR/logs"
[ ! -d "$data_dir" ] && mkdir -p "$data_dir"
#[ ! -d "$logs_dir" ] && mkdir -p "$logs_dir"
topics="movies politics sports" # Must be the same as tweets_collect file. You can that some separated by space
for t in $topics; do
input_file="$data_dir/tweets_$t.json"
output_file="$data_dir/tweets_$t"
output_file_ext="txt" # change it to csv if you want
# gérer l'exécution avec poetry :)
poetry run python3 "$PROJECT_DIR/tweets_manager/tweets_process.py" --input_file "$input_file" \
--output_file "$output_file" \
--topic "$t" \
--output_file_ext "$output_file_ext"
done