Wake: Context-Sensitive Automatic Keyword Extraction Using Word2vec

Related tags

Text Data & NLPWake
Overview

Wake

Wake: Context-Sensitive Automatic Keyword Extraction Using Word2vec

Abstract

استخراج خودکار کلمات کلیدی متون کوتاه فارسی با استفاده از word2vec

با رشد روز افزون اسناد و متون الکترونیکی به زبان فارسی، به کارگیری روش­هایی سریع و ارزان برای دسترسی بـه متـون مورد نظر از میان مجموعه وسیع این مستندات، اهمیت بیشتری می­یابد. برای رسیدن به این هدف، استخراج کلمات کلیدی که بیانگر مضمون اصلی متن باشند، روشی بسیار مؤثر است. تعداد تکرار یک کلمه در متن نمی­تواند نشان­دهنده­ اهمیت یک کلمه و کلیدی بودن آن باشد. همچنین در اکثر روش­های استخراج کلمات کلیدی مفهوم و معنای متن نادیده گرفته می­شوند. از طرفی دیگر بدون ساختار بودن متون جدید در اخبار و اسناد الکترونیکی، استخراج این کلمات را مشکل می­سازد. در این مقاله روشی بدون نظارت و خودکار برای استخراج این کلمات در زبان فارسی که دارای ساختار مناسبی نمی­باشد، پیشنهاد شده است که نه تنها احتمال رخ دادن کلمه در متن و تعداد تکرار آن را در نظر می­گیرد، بلکه با آموزش مدل word2vec روی متن، مفهوم و معنای متن را نیز درک می­کند. در روش پیشنهادی که روشی ترکیبی از دو مدل آماری و یادگیری ماشین می­باشد، پس از آموزش word2vec روی متن، کلماتی که با سایر کلمات دارای فاصله­ کمی بوده استخراج شده و سپس با استفاده از هم­رخدادی و فرکانس رابطه­ای آماری برای محاسبه امتیاز پیشنهاد شده است. درنهایت با استفاده از حدآستانه کلمات با امتیاز بالاتر به‌عنوان کلمه کلیدی در نظر گرفته می­شوند. ارزیابی­­ها بیانگر کارایی روش با معیار F برابر 53.92% و با 11% افزایش نسبت به دیگر روش‌های استخراج کلمات کلیدی می­باشد.

Run

This project requires a data set as the context and target text (which is short text: between 500 and 1000 tokens).

In the code the name of the Context text is cntText and the name of target text is shortTxt. The main part of the program consists of two lines of code:

wake = Wake.wake(cntTxt , use_PreTrain_Model, word2vec_param, model_add) key = wake.keyword_EXT(shortTxt,numKey)

word2vec_param is a tuple contains parameters for traning Word2vec: (window_size, min_count) use_PreTrain_Model is a binary variable that indicates whether the pre-trained model is being used: if use_PreTrain_Model=1 -> using pretrain Model model_add is the address of pretrain model that can be empty

Example

In this project, text keywords are automatically extracted based on its context. For example for the following input text:

وزرای امور خارجه آمریکا و عربستان در پایان سفر مایک پامپئو به ریاض در کنفرانسی مطبوعاتی تاکید کردند که محور گفت وگوهایشان ایران و `` مقابله با سیاست های ایران در منطقه '' بوده است . به گزارش ایسنا ، به نقل از شبکه اسکای نیوز عربی ، مایک پامپئو ، وزیر خارجه جدید آمریکا در این کنفرانس مطبوعاتی گفت : ما شراکت ویژه ای با عربستان داریم که این شراکت و همکاری در حال گسترش است . دیدارهای بسیار خوبی با همتای عربستانی خود و نیز پادشاه و دیگر مسئولان این کشور داشتم . رئیس جمهور ترامپ بسیار خوشحال می شود میزبان پادشاه عربستان و مسئولان اقتصادی این کشور در کاخ سفید باشد . وزیر امور خارجه آمریکا ادامه داد : امنیت عربستان یک اولویت اصلی برای ایالات متحده است و ما با عربستان کار می کنیم تا امنیت در این کشور ارتقا یابد . پامپئو در بخش دیگری از سخنانش به مساله ایران پرداخت و مدعی شد : ایران باعث ایجاد ناامنی و بی ثباتی در منطقه و بزرگترین حامی تروریسم در جهان است . این کشور با شبه نظامیان وابسته به خود در سوریه ، عراق و یمن و نیز با حملات سایبری به ایجاد ناامنی دست می زند . باید بگویم برخلاف دولت قبلی ایالات متحده ما دست بسته نمی نشینیم . اطمینان می دهم ایران هیچگاه به سلاح اتمی دست نخواهد یافت . او ادامه داد : درباره توافق هسته ای با ایران نیز باید بگویم رفتار ایران بعد از این توافق بدتر شده است . همانگونه که رئیس جمهور ترامپ گفته است این توافق باید اصلاح شود و اگر اصلاح نشود و یا قابل اصلاح نباشد ما از آن خارج می شویم . پامپئو ادامه داد : باید جلوی اقدامات ایران از جمله کمک به حوثی ها گرفته شود . حوثی ها با پرتاب موشک و نیز به خطر انداختن امنیت دریانوردی ، عربستان و امنیت منطقه را تهدید می کنند . ما به عربستان در مقابله با این تهدیدات کمک خواهیم کرد . همزمان نیز مذاکرات با نماینده سازمان ملل در یمن را پی می گیریم تا اوضاع در یمن که باعث ظهور و رشد القاعده شده ، وخیم تر نشود . خطر علیه منطقه یقینا تهدید علیه ایالات متحده است . وزیر امور خارجه آمریکا به سفر ترامپ به عربستان نیز اشاره کرد و گفت : سفر ترامپ به منطقه یک سفر تاریخی بود که در آن یک سازمان مبارزه با تروریسم تشکیل شد . ما متعهد به پیگیری اقداماتمان در این راستا هستیم البته خاورمیانه و شرکایمان نباید منتظر آمریکا بمانند و اطمینان داریم که عربستان در مبارزه با تروریسم پیش قراول دیگر کشورها خواهد بود . مایک پامپئو در پایان سخنان خود با ستایش از اقدامات اصلاحی ولیعهد عربستان ، به چشم انداز 2030 این کشور اشاره کرد و گفت که ایالات متحده آمریکا حامی برنامه های محمد بن سلمان ، ولیعهد عربستان است و اصلاحات ایجاد شده در این کشور به ویژه در زمینه حقوق زنان را ستایش می کند . عادل الجبیر ، وزیر امور خارجه عربستان نیز به عنوان میزبان همتای آمریکایی خود در آغاز این کنفرانس مطبوعاتی گفت که با پامپئو توافق کرده تا مانع `` خواسته های روزافزون ایران در منطقه '' شود . وی گفت : دو کشور بر سر مبارزه با `` اقدامات بی ثبات کننده ایران '' در منطقه توافق دارند . ما از سیاست های آمریکا در قبال ایران به طور کامل حمایت می کنیم که از جمله آن سیاست های ایالات متحده در قبال برنامه هسته ای ایران است .

The 10 keywords extracted by the model are:

('ایران', 4.05292034373375)

('عربستان', 4.193905604785485)

('کشور', 4.7680901504699245)

('آمریکا', 4.941453550088568)

('منطقه', 4.949306749139798)

('ایالات', 5.365563238340798)

('متحده', 5.444792335101005)

('توافق', 5.479569006927752)

('خارجه', 5.616200457615028)

('ترامپ', 5.829934633246103)

Note

In this model, lower score means higher priority.

Reference:

Implemented article

Owner
Omid Hajipoor
Ph.D. Student, NLP Engineer
Omid Hajipoor
Harvis is designed to automate your C2 Infrastructure.

Harvis Harvis is designed to automate your C2 Infrastructure, currently using Mythic C2. 📌 What is it? Harvis is a python tool to help you create mul

Thiago Mayllart 99 Oct 06, 2022
A PyTorch-based model pruning toolkit for pre-trained language models

English | 中文说明 TextPruner是一个为预训练语言模型设计的模型裁剪工具包,通过轻量、快速的裁剪方法对模型进行结构化剪枝,从而实现压缩模型体积、提升模型速度。 其他相关资源: 知识蒸馏工具TextBrewer:https://github.com/airaria/TextBrewe

Ziqing Yang 231 Jan 08, 2023
Code for "Parallel Instance Query Network for Named Entity Recognition", accepted at ACL 2022.

README Code for Two-stage Identifier: "Parallel Instance Query Network for Named Entity Recognition", accepted at ACL 2022. For details of the model a

Yongliang Shen 45 Nov 29, 2022
Question and answer retrieval in Turkish with BERT

trfaq Google supported this work by providing Google Cloud credit. Thank you Google for supporting the open source! 🎉 What is this? At this repo, I'm

M. Yusuf Sarıgöz 13 Oct 10, 2022
Multilingual finetuning of Machine Translation model on low-resource languages. Project for Deep Natural Language Processing course.

Low-resource-Machine-Translation This repository contains the code for the project relative to the course Deep Natural Language Processing. The goal o

Andrea Cavallo 3 Jun 22, 2022
This is the source code of RPG (Reward-Randomized Policy Gradient)

RPG (Reward-Randomized Policy Gradient) Zhenggang Tang*, Chao Yu*, Boyuan Chen, Huazhe Xu, Xiaolong Wang, Fei Fang, Simon Shaolei Du, Yu Wang, Yi Wu (

40 Nov 25, 2022
Baseline code for Korean open domain question answering(ODQA)

Open-Domain Question Answering(ODQA)는 다양한 주제에 대한 문서 집합으로부터 자연어 질의에 대한 답변을 찾아오는 task입니다. 이때 사용자 질의에 답변하기 위해 주어지는 지문이 따로 존재하지 않습니다. 따라서 사전에 구축되어있는 Knowl

VUMBLEB 69 Nov 04, 2022
Use PaddlePaddle to reproduce the paper:mT5: A Massively Multilingual Pre-trained Text-to-Text Transformer

MT5_paddle Use PaddlePaddle to reproduce the paper:mT5: A Massively Multilingual Pre-trained Text-to-Text Transformer English | 简体中文 mT5: A Massively

2 Oct 17, 2021
Code for the Python code smells video on the ArjanCodes channel.

7 Python code smells This repository contains the code for the Python code smells video on the ArjanCodes channel (watch the video here). The example

55 Dec 29, 2022
A tool helps build a talk preview image by combining the given background image and talk event description

talk-preview-img-builder A tool helps build a talk preview image by combining the given background image and talk event description Installation and U

PyCon Taiwan 4 Aug 20, 2022
Use the state-of-the-art m2m100 to translate large data on CPU/GPU/TPU. Super Easy!

Easy-Translate is a script for translating large text files in your machine using the M2M100 models from Facebook/Meta AI. We also privide a script fo

Iker García-Ferrero 41 Dec 15, 2022
Chinese NER with albert/electra or other bert descendable model (keras)

Chinese NLP (albert/electra with Keras) Named Entity Recognization Project Structure ./ ├── NER │   ├── __init__.py │   ├── log

2 Nov 20, 2022
Python3 to Crystal Translation using Python AST Walker

py2cr.py A code translator using AST from Python to Crystal. This is basically a NodeVisitor with Crystal output. See AST documentation (https://docs.

66 Jul 25, 2022
Tools for curating biomedical training data for large-scale language modeling

Tools for curating biomedical training data for large-scale language modeling

BigScience Workshop 242 Dec 25, 2022
CoSENT 比Sentence-BERT更有效的句向量方案

CoSENT 比Sentence-BERT更有效的句向量方案

苏剑林(Jianlin Su) 201 Dec 12, 2022
official ( API ) for the zAmericanEnglish app in [ Google play ] and [ App store ]

official ( API ) for the zAmericanEnglish app in [ Google play ] and [ App store ]

Plugin 3 Jan 12, 2022
Dé op-de-vlucht Pieton vertaler. Wereldwijd gebruikt door meer dan 1.000+ succesvolle bedrijven!

Dé op-de-vlucht Pieton vertaler. Wereldwijd gebruikt door meer dan 1.000+ succesvolle bedrijven!

Lau 1 Dec 17, 2021
An automated program that helps customers of Pizza Palour place their pizza orders

PIzza_Order_Assistant Introduction An automated program that helps customers of Pizza Palour place their pizza orders. The program uses voice commands

Tindi Sommers 1 Dec 26, 2021
Club chatbot

Chatbot Club chatbot Instructions to get the Chatterbot working Step 1. First make sure you are using a version of Python 3 or newer. To check your ve

5 Mar 07, 2022
Utilize Korean BERT model in sentence-transformers library

ko-sentence-transformers 이 프로젝트는 KoBERT 모델을 sentence-transformers 에서 보다 쉽게 사용하기 위해 만들어졌습니다. Ko-Sentence-BERT-SKTBERT 프로젝트에서는 KoBERT 모델을 sentence-trans

Junghyun 40 Dec 20, 2022