Skip to content

Commit

Permalink
✨ spaCy updates up to 3.0.5 (#47)
Browse files Browse the repository at this point in the history
### ⚠️ Cautions and Deprecations!

- update spaCy up to `3.0.5`;
- update spaCy model `en_core_web_sm` up to `3.0.0`;
- update `pdfminer.six` up to `20201018`;
- update `flask-cors` up to `3.0.10`;
- added new documents for testing services for English language;
- changed API endpoint URL to get XML structure ** allterms.xml ** for English language:
  old:
  `host[:port]/ken/api/en/file/allterm`
  new:
  `host[:port]/ken/api/en/allterms`
 From now on, the same API endpoint is used for processing/analyzing English texts in the form of messages and files: `host[:port]/ken/api/en/allterms`.

### 🏭 New features

- аdded API for text processing / analysis in English (namely, receiving `allterms.xml`) in the form of messages. Example of input data:
  ```json
  {
    "message": "After the vision of the Semantic Web was broadcasted at the turn of the millennium, ontology became a synonym for the solution to many problems concerning the fact that computers do not understand human language: if there were an ontology and every document were marked up with it and we had agents that would understand the mark-up, then computers would finally be able to process our queries in a really sophisticated way. Some years later, the success of Google shows us that the vision has not come true, being hampered by the incredible amount of extra work required for the intellectual encoding of semantic mark-up – as compared to simply uploading an HTML page."
  }
  ```
  HTTP method: POST
  API Endpoint: `host[:port]/ken/api/en/allterms`

### 👍 Improvements

- improved processing of complex English terms, in particular, from three words;
- updated API description for text processing / analysis in the form of messages and files for English and Ukrainian languages in the file `HELP.md`.

### 🔴 Bug fixes

- fixed errors in displaying / visualizing dependencies for terms in the `# depparse_tab` element, namely in` # displacy`;
- various bugfixes.
  • Loading branch information
malakhovks committed Apr 16, 2021
1 parent 5e64230 commit 4df3aec
Show file tree
Hide file tree
Showing 13 changed files with 1,381 additions and 507 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
## v3.2.0, 2021-04-16

### ⚠️ Зауваження

- ENG🇬🇧 оновлено бібліотеку spaCy до версії `3.0.5`;
- ENG🇬🇧 оновлено модель бібліотеки spaCy для англійської мови `en_core_web_sm` до версії `3.0.0`;
- оновлено бібліотеку `pdfminer.six` до версії `20201018`;
- оновлено бібліотеку `flask-cors` до версії `3.0.10`;
- ENG🇬🇧 додано нові документи для тестування сервісів для Англійської мови;
- ENG🇬🇧 Змінено URL кінцевої точки API для отримання XML-структуру **allterms.xml**:
було:
`host[:port]/ken/api/en/file/allterm`
стало:
`host[:port]/ken/api/en/allterms`
Відтепер для обробки/аналізу текстів у вигляді повідомлень та файлів діє одна й та сама кінцева точка API: `host[:port]/ken/api/en/allterms`.

### 🏭 Нові можливості

- ENG🇬🇧 Додано API для обробки/аналізу текстів (а саме, отримання `allterms.xml`) у вигляді повідомлень. Приклад вхідних даних:
```json
{
"message": "After the vision of the Semantic Web was broadcasted at the turn of the millennium, ontology became a synonym for the solution to many problems concerning the fact that computers do not understand human language: if there were an ontology and every document were marked up with it and we had agents that would understand the mark-up, then computers would finally be able to process our queries in a really sophisticated way. Some years later, the success of Google shows us that the vision has not come true, being hampered by the incredible amount of extra work required for the intellectual encoding of semantic mark-up – as compared to simply uploading an HTML page."
}
```
HTTP method: POST
Кінцева точка: `host[:port]/ken/api/en/allterms`

### 👍 Покращення

- ENG🇬🇧 покращено обробку складних термінів, зокрема, з трьох слів;
- UKR🇺🇦 ENG🇬🇧 Оновлено опис API для обробки/аналізу текстів у вигляді повідомлень та файлів для Англійської та Української мов у файлі `HELP.md`.

### 🔴 Виправлення помилок

- UKR🇺🇦 ENG🇬🇧 виправлені помилки відображення/візуалізації залежностей для термінів в елементі `#depparse_tab`, а саме в `#displacy`;
- UKR🇺🇦 ENG🇬🇧 дрібні виправлення.

## v3.1.0, 2021-03-02

### 👍 Покращення
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.9-slim-stretch
FROM python:3.7.10-slim-stretch
# FROM python:3.7.7-slim-stretch
# FROM python:2.7-slim-stretch

Expand Down
85 changes: 81 additions & 4 deletions HELP.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Конспект для української мови (API для обробки/аналізу текстів у вигляді повідомлень)
# Конспект для Української мови (API для обробки/аналізу текстів у вигляді повідомлень та файлів)

### API endpoints

| | Service | API endpoint | HTTP method |
| :----: | :------------------------------------------: | :----------------------------------------------------------- | :---------: |
| **E1** | Черга для обробки повідомлень | `host[:port]/kua/api/task/message/queued`<br>`http://194.44.28.250:45100/kua/api/task/message/queued` | POST |
| **E2** | Статус виконання обробки | `host[:port]/kua/api/task/status`<br/>`http://194.44.28.250:45100/kua/api/task/status` | GET |
| **E3** | Отримати XML-структуру **allterms** | `host[:port]/kua/api/task/allterms/result`<br/>`http://194.44.28.250:45100/kua/api/task/allterms/result` | GET |
| **E4** | Отримати XML-структуру **parce** | `host[:port]/kua/api/task/parce/result`<br/>`http://194.44.28.250:45100/kua/api/task/parce/result` | GET |
| **E3** | Отримати XML-структуру **allterms.xml** | `host[:port]/kua/api/task/allterms/result`<br/>`http://194.44.28.250:45100/kua/api/task/allterms/result` | GET |
| **E4** | Отримати XML-структуру **parce.xml** | `host[:port]/kua/api/task/parce/result`<br/>`http://194.44.28.250:45100/kua/api/task/parce/result` | GET |

##### E1 - Input data

Expand Down Expand Up @@ -86,4 +86,81 @@ curl "http://194.44.28.250:45100/kua/api/task/parce/result?id=uwsgi_spoolfile_on

або

`Return 200` та XML-структура
`Return 200` та XML-структура

# Конспект для Англійської мови (API для обробки/аналізу текстів у вигляді повідомлень та файлів)

### API endpoints

| | Service | API endpoint | HTTP method |
| :----: | :------------------------------------------: | :----------------------------------------------------------- | :---------: |
| **E1** | Отримати XML-структуру **allterms.xml** з файлу | `host[:port]/ken/api/en/allterms` | POST |
| **E2** | Отримати XML-структуру **allterms.xml** з повідомлення | `host[:port]/ken/api/en/allterms` | POST |
| **E3** | Отримати XML-структуру **parce.xml** з файлу | `host[:port]/ken/api/en/file/parcexml` | POST |

##### E1 - Input data

Вхідними даними можуть бути файли форматів `.txt`, `.docx`, `.pdf`, які містять текстові дані англійською мовою.

Використовуючи метод `http`-запиту `POST` можна відправити тільки один файл (доступних форматів) для опрацювання службою формування спеціалізованої `XML`-структури тексту.

Приклад `POST` запиту до кінцевої точки служби **S1** на мові програмування `JavaScript` з використанням [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API):

```javascript
# Детальний опис Fetch API за посиланням https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

# Файли можна завантажувати за допомогою елемента вводу HTML <input type = "file" />, FormData() та fetch().
var formData = new FormData();
var fileField = document.querySelector('input[type="file"]');

# https://developer.mozilla.org/en-US/docs/Web/API/FormData/append
# formData.append(name, value);
formData.append('file', fileField.files[0]);

fetch("file", 'host[:port]/ken/api/en/allterms', {
method: 'post',
body: formData
})
.then(response => response.text())
.catch(error => console.error('Error:', error))
.then(response => console.log('Success:', response));
```
Процес формування спеціалізованої `XML`-структури тексту може зайняти деякий час (в залежності від обсягу тексту), але в загальному випадку вихідні дані формуються миттєво.

##### E2 - Input data

```JSON
{
"message": "After the vision of the Semantic Web was broadcasted at the turn of the millennium, ontology became a synonym for the solution to many problems concerning the fact that computers do not understand human language: if there were an ontology and every document were marked up with it and we had agents that would understand the mark-up, then computers would finally be able to process our queries in a really sophisticated way.."
}
```

##### E3 - Input data

Вхідними даними можуть бути файли форматів `.txt`, `.docx`, `.pdf`.

Використовуючи метод `http`-запиту `POST` можна відправити тільки один файл (доступних форматів) для опрацювання службою формування спеціалізованої `XML`-структури тексту.

Приклад `POST` запиту до кінцевої точки служби **S2** на мові програмування `JavaScript` з використанням [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API):

```javascript
# Детальний опис Fetch API за посиланням https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

# Файли можна завантажувати за допомогою елемента вводу HTML <input type = "file" />, FormData() та fetch().
var formData = new FormData();
var fileField = document.querySelector('input[type="file"]');

# https://developer.mozilla.org/en-US/docs/Web/API/FormData/append
# formData.append(name, value);
formData.append('file', fileField.files[0]);

fetch("file", 'host[:port]/ken/api/en/file/parcexml', {
method: 'post',
body: formData
})
.then(response => response.text())
.catch(error => console.error('Error:', error))
.then(response => console.log('Success:', response));
```

Процес формування спеціалізованої `XML`-структури тексту може зайняти деякий час (в залежності від обсягу тексту), але в загальному випадку вихідні дані формуються миттєво.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ $ docker run --restart always --name ken -d -p 80:80 ken_image

| Позначення |Служба|Кінцева точка API|Метод http-запиту|
| :--------: | :---------------------: | :--------- | :--------: |
| **S1** | формування спеціалізованої `XML`-структури тексту *allterms.xml* |`host[:port]/ken/api/en/file/allterms`|POST|
| **S1** | формування спеціалізованої `XML`-структури тексту *allterms.xml* |`host[:port]/ken/api/en/allterms`|POST|
| **S2** | формування спеціалізованої `XML`-структури тексту *parce.xml* |`host[:port]/ken/api/en/file/parcexml`|POST|
| **S3** | візуалізації залежностей термінів |`host[:port]/ken/api/en/html/depparse/nounchunk`|POST|
| **S4** | візуалізації іменованих сутностей тексту |`host[:port]/ken/api/en/html/ner`|POST|
Expand Down Expand Up @@ -660,7 +660,7 @@ var fileField = document.querySelector('input[type="file"]');
# formData.append(name, value);
formData.append('file', fileField.files[0]);

fetch("file", 'host[:port]/ken/api/en/file/allterms', {
fetch("file", 'host[:port]/ken/api/en/allterms', {
method: 'post',
body: formData
})
Expand Down
15 changes: 8 additions & 7 deletions deploy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Flask==1.1.2
flask-cors==3.0.8
# flask-cors==3.0.8
flask-cors==3.0.10
# spacy>=2.2.0,<3.0.0
# spacy==2.3.2
spacy==2.3.5
# https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz#egg=en_core_web_sm
# https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.0/en_core_web_sm-2.3.0.tar.gz#egg=en_core_web_sm
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_sm
spacy==3.0.5
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz#egg=en_core_web_sm
# https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.0.0/en_core_web_trf-3.0.0.tar.gz#egg=en_core_web_trf
# https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.0.0/en_core_web_lg-3.0.0.tar.gz#egg=en_core_web_lg
# pdfminer.six==20200402
pdfminer.six==20200517
# pdfminer.six==20200517
pdfminer.six==20201018
uWSGI==2.0.18
nltk==3.5
chardet==3.0.4
Expand Down
Loading

0 comments on commit 4df3aec

Please sign in to comment.