some edit on kw readme

This commit is contained in:
ajokar 2025-08-16 15:57:21 +03:30
parent 61c50ae476
commit 3bdaddcd61
5 changed files with 12 additions and 17 deletions

View File

@ -15,7 +15,8 @@ model = "./models/ner/2025-07-22--20-44-37--HooshvareLab--bert-fa-base-uncased-n
tagger = SequenceTagger.load(model)
print('model read and tagger initialized')
today = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}'
date = datetime.datetime.now()
today = f'{date.year}-{date.month}-{date.day}-{date.hour}'
def prepare_data(ner_obj_list):
ner_data_list = []

View File

@ -15,7 +15,8 @@ os.environ['HF_HOME'] = "/home/admin/HFHOME"
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
#model_id = "meta-llama/Llama-3.1-70B-Instruct"
today = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}'
date = datetime.datetime.now()
today = f'{date.year}-{date.month}-{date.day}-{date.hour}'
bnb_config = BitsAndBytesConfig(
load_in_8bit=True, bnb_8bit_use_double_quant=True, bnb_8bit_quant_type="nf8", bnb_8bit_compute_dtype=torch.bfloat16

View File

@ -6,7 +6,8 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
import json
today = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}-{datetime.datetime.now().hour}'
date = datetime.datetime.now()
today = f'{date.year}-{date.month}-{date.day}-{date.hour}'
if torch.cuda.is_available():
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"

View File

@ -1,10 +1,9 @@
# Keyword Extractor
This project is a simple script for extracting keywords from text using Natural Language Processing (NLP).
This source is a script for extracting keywords from text using local LLM such as llama based on user prompts.
## 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.
The script processes input text and extracts the most relevant keywords using a large language model(llm) and system and user prompts which are embedded in the source code.
## Requirements
- Python 3.8+
@ -31,8 +30,5 @@ For exact versions of the libraries, please check the **`requirements.txt`** fil
- `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.
The script uses a LLM such as llama3.1-8B 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.

View File

@ -1,10 +1,9 @@
# استخراج‌گر کلمات کلیدی
این پروژه یک اسکریپت ساده برای استخراج کلمات کلیدی از متن با استفاده از **پردازش زبان طبیعی (NLP)** است.
این سورس، یک اسکریپت برای استخراج کلمات کلیدی از متن با استفاده از مدل های زبانی بزرگی مانند لاما و بر اساس پرامپت های کاربر است.
## نحوه عملکرد
این اسکریپت متن ورودی را پردازش کرده و مرتبط‌ترین کلمات کلیدی را با استفاده از یک **مدل از پیش آموزش‌دیده (Transformer Model)** (مانند `bert-base-uncased` یا مدل مشابه) استخراج می‌کند.
طراحی آن ساده، سبک و قابل تغییر است.
این اسکریپت متن ورودی را پردازش کرده و مرتبط‌ترین کلمات کلیدی را با استفاده از یک مدل زبانی بزرگ با پرامپت های سیستمی و کاربری که در سورس قابل مشاهده است، استخراج می کند
## پیش‌نیازها
- پایتون 3.8 یا بالاتر
@ -31,8 +30,5 @@
- `display_results(keywords)`: نمایش یا ذخیره‌سازی کلمات کلیدی استخراج‌شده برای استفاده‌های بعدی.
## مدل
این اسکریپت از یک **مدل مبتنی بر Transformer** برای استخراج کلمات کلیدی استفاده می‌کند. در صورت نیاز می‌توانید مدل را در کد تغییر دهید.
این اسکریپت از یک مدل زبانی بزرگ مانند llama3.1-8B برای استخراج کلمات کلیدی استفاده می‌کند. در صورت نیاز می‌توانید مدل را در کد تغییر دهید.
## نکات
- با زبان انگلیسی (و در صورت پشتیبانی مدل، سایر زبان‌ها) کار می‌کند.
- کیفیت نتایج به مدل و متن ورودی وابسته است.