kw readme
This commit is contained in:
parent
c0bd51d91d
commit
61c50ae476
|
@ -7,7 +7,7 @@ from p1_classifier import do_classify
|
|||
from p2_ner_recognizer import do_ner_recognize
|
||||
from p3_words_embedder import do_word_embedder
|
||||
from p4_keyword_extractor import do_keyword_extract
|
||||
from p5_simplifier import do_representation
|
||||
from p5_representer import do_representation
|
||||
|
||||
from elastic_helper import ElasticHelper
|
||||
import json
|
||||
|
|
38
readme/readme-keyword-extractor-en.md
Normal file
38
readme/readme-keyword-extractor-en.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Keyword Extractor
|
||||
|
||||
This project is a simple script for extracting keywords from text using Natural Language Processing (NLP).
|
||||
|
||||
## How it works
|
||||
The script processes input text and extracts the most relevant keywords using a **pre-trained transformer model** (e.g., `bert-base-uncased` or a similar NLP model).
|
||||
It is designed to be lightweight, easy to run, and customizable.
|
||||
|
||||
## Requirements
|
||||
- Python 3.8+
|
||||
- NLP libraries (transformers, torch, etc.)
|
||||
- Other utilities as listed in the requirements file
|
||||
|
||||
For exact versions of the libraries, please check the **`requirements.txt`** file.
|
||||
|
||||
## Usage
|
||||
1. Clone the repository.
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
3. Run the script:
|
||||
```bash
|
||||
python keyword_extractor.py
|
||||
```
|
||||
|
||||
## Main Methods
|
||||
- `load_model()`: Loads the pre-trained transformer model for text processing. This is the main method for model initialization.
|
||||
- `preprocess_text(text)`: Cleans and prepares the input text (e.g., lowercasing, removing stopwords, etc.).
|
||||
- `extract_keywords(text, top_n=10)`: The core method that applies the model and retrieves the top keywords from the input text.
|
||||
- `display_results(keywords)`: Prints or saves the extracted keywords for further use.
|
||||
|
||||
## Model
|
||||
The script uses a **transformer-based model** for keyword extraction. The exact model can be changed in the code if needed.
|
||||
|
||||
## Notes
|
||||
- Works with English (and potentially other languages, depending on the model).
|
||||
- Results may vary based on the model and input text.
|
38
readme/readme-keyword-extractor-fa.md
Normal file
38
readme/readme-keyword-extractor-fa.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# استخراجگر کلمات کلیدی
|
||||
|
||||
این پروژه یک اسکریپت ساده برای استخراج کلمات کلیدی از متن با استفاده از **پردازش زبان طبیعی (NLP)** است.
|
||||
|
||||
## نحوه عملکرد
|
||||
این اسکریپت متن ورودی را پردازش کرده و مرتبطترین کلمات کلیدی را با استفاده از یک **مدل از پیش آموزشدیده (Transformer Model)** (مانند `bert-base-uncased` یا مدل مشابه) استخراج میکند.
|
||||
طراحی آن ساده، سبک و قابل تغییر است.
|
||||
|
||||
## پیشنیازها
|
||||
- پایتون 3.8 یا بالاتر
|
||||
- کتابخانههای NLP (مانند transformers، torch و …)
|
||||
- سایر ابزارهای مورد نیاز در فایل requirements.txt
|
||||
|
||||
برای مشاهده نسخه دقیق کتابخانهها به فایل **`requirements.txt`** مراجعه کنید.
|
||||
|
||||
## روش اجرا
|
||||
1. مخزن (repository) را کلون کنید.
|
||||
2. پیشنیازها را نصب کنید:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
3. اسکریپت را اجرا کنید:
|
||||
```bash
|
||||
python keyword_extractor.py
|
||||
```
|
||||
|
||||
## متدهای اصلی
|
||||
- `load_model()`: بارگذاری مدل از پیش آموزشدیده برای پردازش متن. این متد اصلی برای آمادهسازی مدل است.
|
||||
- `preprocess_text(text)`: پاکسازی و آمادهسازی متن ورودی (مانند کوچکسازی حروف، حذف توقفواژهها و ...).
|
||||
- `extract_keywords(text, top_n=10)`: متد اصلی استخراج که کلمات کلیدی را با استفاده از مدل انتخاب کرده و n کلمه برتر را برمیگرداند.
|
||||
- `display_results(keywords)`: نمایش یا ذخیرهسازی کلمات کلیدی استخراجشده برای استفادههای بعدی.
|
||||
|
||||
## مدل
|
||||
این اسکریپت از یک **مدل مبتنی بر Transformer** برای استخراج کلمات کلیدی استفاده میکند. در صورت نیاز میتوانید مدل را در کد تغییر دهید.
|
||||
|
||||
## نکات
|
||||
- با زبان انگلیسی (و در صورت پشتیبانی مدل، سایر زبانها) کار میکند.
|
||||
- کیفیت نتایج به مدل و متن ورودی وابسته است.
|
|
@ -61,5 +61,4 @@ Each section will have a new field `ners_v2` with the extracted entities:
|
|||
## Notes
|
||||
|
||||
- Make sure the model path is correct and the model file is available.
|
||||
- The script supports Persian language if the model is trained for it.
|
||||
- The output JSON file will be saved in `./data/ner/`.
|
||||
|
|
|
@ -61,5 +61,4 @@ result = do_ner_recognize(sections)
|
|||
## نکات
|
||||
|
||||
- مطمئن شوید مسیر مدل صحیح است و فایل مدل در دسترس است.
|
||||
- اگر مدل برای زبان فارسی آموزش دیده باشد، اسکریپت از زبان فارسی پشتیبانی میکند.
|
||||
- فایل خروجی JSON در مسیر `./data/ner/` ذخیره خواهد شد.
|
||||
|
|
Loading…
Reference in New Issue
Block a user