How hltcoe/predpatt works
Main Components
• Core Extraction Library ("predpatt" directory):
• This contains modules such as UDParse.py, patt.py, rules.py, and util files (e.g., UDParser.py and others). These files encapsulate the main functionality for processing Universal Dependencies and executing predicate-argument extraction.
• REST API Layer ("api/rest" directory):
• Contains app.py, Dockerfile, and parsing script (ParseyPredFace.py) which likely wraps the core library into a web service.
• This layer is designed to expose the core functionalities as RESTful endpoints, making them easily accessible to external applications.
• Command-line / Server Interface ("bin" directory):
• The server.py script here may be used to run the application in a command-line mode or serve as a lightweight server, providing another mode of interaction with the core functionality.
• Testing and Documentation:
• The "test" directory, with various conllu and expect files and notebook examples, shows that there is a robust test suite ensuring accuracy and gives usage examples.
• The "doc" directory and "tutorial.ipynb" provide extensive documentation and usage guidelines.
• Configuration and Setup:
• Files like setup.py and the LICENSE/README at the top level help in configuring and distributing the project.
Relationships and Interactions
• The REST API (api/rest) acts as an intermediary between external requests and the core processing logic in the "predpatt" module.
• The command-line interface (bin/server.py) provides an entry point that, like the API, leverages the core extraction functions.
• The core library is the heart of the system and is designed for extensibility; its outputs are used by both the API and CLI modes.
• Testing and documentation components ensure that the correct function of these layers is maintained and demonstrate usage.
Architectural Patterns and Design Principles
• Modular Design: The separation into a core library ("predpatt"), REST API layer, and CLI layer shows a clear separation of concerns.
• Extensibility: The core extraction engine is designed with extensible, interpretable rules – it allows for further layers of semantic annotation.
• Reusability: The same extraction functions are used in multiple interfaces (API, command-line), emphasizing code reuse.
• Containerization: The presence of Dockerfile under the API directory suggests that containerized deployment was considered for easy distribution and environment management.
Relevant Technologies and Frameworks
• Primary Language: Python.
• Web Framework: Likely Flask or a similar lightweight framework (inferred from app.py in the API directory).
• Containerization: Docker (as indicated by the Dockerfile).
• Testing Tools and Notebook: Python tests and the Jupyter Notebook (tutorial.ipynb) for interactive demonstration.
• Standard scripting practices via server scripts and setup files.
Elements
• Core Extraction Module (predpatt) – label submodules such as UD parsing, rule processing, and utility functions.
• REST API Service – include Docker container depiction, API entry point (app.py), and parsing interface (ParseyPredFace.py).
• Command-line Interface/Server (bin/server.py) – a separate node for CLI operations.
• Visual Differentiations:
Putting It All Together
– From the user's perspective, inputs travel from network requests or command-line commands into these interfaces.
– Include external dependencies like Docker for containerized deployment.
– Finally, note that extensive tests and documentation support the overall system and should be referenced as part of the development and verification process.
Happy diagramming!