You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project was created for the purpose of an interview test. Its goal is to build an API endpoint that returns name entities given a sentence as an input.
4
8
5
9
## Dependencies
6
10
7
11
- FastAPI: Web framework to build APIs with Python
12
+
- spaCY: Library for NLP in Python
8
13
- pre-commit: It allows me to run some checks before a git commit is done
9
14
- commitizen: It gives a standard way to commit code and also allows me to version the code
10
15
- pytest: Used to run the tests
11
-
- Azure pipelines: Used to run a pipeline everytime there is a commit o a new tag is added for a new release with automated release notes.
16
+
- Azure pipelines: Used to run a pipeline everytime there is a commit o a new tag is added for a new release with automated release notes
There are two ways to run the project, via Docker or through python virtual environment.
25
31
26
-
## With docker
32
+
###With docker
27
33
28
34
If we want to run with Docker, we first need to build an image:
29
35
@@ -33,26 +39,43 @@ And then run an instance:
33
39
34
40
`docker run -i -d -p 8080:5000 example-api`
35
41
36
-
## Without docker
42
+
###Without docker
37
43
38
44
However, if we want to run without Docker, we can run directly with uvicorn:
39
45
40
46
```
41
47
pipenv run uvicorn --host 0.0.0.0 --port 5000 app.main:app
42
48
```
43
49
44
-
###Tests
50
+
## Tests
45
51
46
52
Run this command to run tests with coverage:
47
53
48
-
`python -m pytest --cov=app`
54
+
`pipenv run pytest --cov=app`
55
+
56
+
## Formatting
57
+
58
+
Run the following command to format all the project:
49
59
50
-
### Deploying
60
+
`pipenv run pre-commit run --all-files`
51
61
52
-
By running `cz bump` it automatically detecs the version to bump - major, minor or patch. It follows [SemVer](https://semver.org/) standard. Then when pushin the code to GitHub, it needs to be done like this:
62
+
## Deploying
63
+
64
+
By running `cz bump` it automatically detecs the version to bump - major, minor or patch. It follows [SemVer](https://semver.org/) standard. Then when pushing the code to GitHub, it needs to be done like this:
53
65
54
66
```
55
67
git push origin master --tags
56
68
```
57
69
58
70
It will then push the code and the Azure Pipeline will create the GitHub release if the pipeline passes.
71
+
72
+
### API and documentation
73
+
74
+
The API currently has 2 endpoints:
75
+
76
+
-`/api/v1/sentence/process`: It processess a sentence
77
+
-`/check`: It checks the system is running
78
+
79
+
Furthermore, FastAPI automatically generates the documentation for you, so when running you can access to `/docs` and you will be able to see in detail all the endpoints with its I/O.
80
+
81
+
For the sentence processing, I hace used `spacy`, a free open-source library for NLP in Python. [These](https://spacy.io/api/annotation#named-entities) are the named entity types that can be sent by the API.
0 commit comments