-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtest_script.py
44 lines (35 loc) · 1.25 KB
/
test_script.py
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
#!/usr/bin/env python3
"""
Simple test of the GlossAPI Corpus functionality with the refactored pipeline
"""
import logging
from pathlib import Path
from glossapi.corpus import Corpus
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("simple_test")
# Test directory - using the directory where we downloaded the paper
TEST_DIR = Path("/home/fivos/CascadeProjects/glossAPI/corpus_test")
def main():
# Create a basic corpus object - using same directory for input and output
logger.info("Creating Corpus object")
corpus = Corpus(
input_dir=TEST_DIR,
output_dir=TEST_DIR
)
# Skipping download step since we already have the PDF file
logger.info("Skipping download step (already have the PDF file)")
# 2. Extract
logger.info("Running extract step")
# Specify the formats we know are in the downloads directory
corpus.extract()
# 4. Section - now uses files marked as 'good' quality
logger.info("Running section step")
corpus.section()
# 5. Annotate
logger.info("Running annotate step")
corpus.annotate(annotation_type="chapter")
# Check results
logger.info("Pipeline completed")
if __name__ == "__main__":
main()