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
LeBenchmark: a reproducible framework for assessing SSL from speech

LeBenchmark: a reproducible framework for assessing SSL from speech

11 Nov 30, 2022
A minimal code for fairseq vq-wav2vec model inference.

vq-wav2vec inference A minimal code for fairseq vq-wav2vec model inference. Runs without installing the fairseq toolkit and its dependencies. Usage ex

Vladimir Larin 7 Nov 15, 2022
A python gui program to generate reddit text to speech videos from the id of any post.

Reddit text to speech generator A python gui program to generate reddit text to speech videos from the id of any post. Current functionality Generate

Aadvik 17 Dec 19, 2022
A Transformer Implementation that is easy to understand and customizable.

Simple Transformer I've written a series of articles on the transformer architecture and language models on Medium. This repository contains an implem

Naoki Shibuya 4 Jan 20, 2022
(ACL-IJCNLP 2021) Convolutions and Self-Attention: Re-interpreting Relative Positions in Pre-trained Language Models.

BERT Convolutions Code for the paper Convolutions and Self-Attention: Re-interpreting Relative Positions in Pre-trained Language Models. Contains expe

mlpc-ucsd 21 Jul 18, 2022
BERT Attention Analysis

BERT Attention Analysis This repository contains code for What Does BERT Look At? An Analysis of BERT's Attention. It includes code for getting attent

Kevin Clark 401 Dec 11, 2022
Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing

Introduction Funnel-Transformer is a new self-attention model that gradually compresses the sequence of hidden states to a shorter one and hence reduc

GUOKUN LAI 197 Dec 11, 2022
A repository to run gpt-j-6b on low vram machines (4.2 gb minimum vram for 2000 token context, 3.5 gb for 1000 token context). Model loading takes 12gb free ram.

Basic-UI-for-GPT-J-6B-with-low-vram A repository to run GPT-J-6B on low vram systems by using both ram, vram and pinned memory. There seem to be some

90 Dec 25, 2022
Dense Passage Retriever - is a set of tools and models for open domain Q&A task.

Dense Passage Retrieval Dense Passage Retrieval (DPR) - is a set of tools and models for state-of-the-art open-domain Q&A research. It is based on the

Meta Research 1.1k Jan 07, 2023
Gathers machine learning and Tensorflow deep learning models for NLP problems, 1.13 < Tensorflow < 2.0

NLP-Models-Tensorflow, Gathers machine learning and tensorflow deep learning models for NLP problems, code simplify inside Jupyter Notebooks 100%. Tab

HUSEIN ZOLKEPLI 1.7k Dec 30, 2022
PORORO: Platform Of neuRal mOdels for natuRal language prOcessing

PORORO: Platform Of neuRal mOdels for natuRal language prOcessing pororo performs Natural Language Processing and Speech-related tasks. It is easy to

Kakao Brain 1.2k Dec 21, 2022
Perform sentiment analysis and keyword extraction on Craigslist listings

craiglist-helper synopsis Perform sentiment analysis and keyword extraction on Craigslist listings Background I love Craigslist. I've found most of my

Mark Musil 1 Nov 08, 2021
An open collection of annotated voices in Japanese language

声庭 (Koniwa): オープンな日本語音声とアノテーションのコレクション Koniwa (声庭): An open collection of annotated voices in Japanese language 概要 Koniwa(声庭)は利用・修正・再配布が自由でオープンな音声とアノテ

Koniwa project 32 Dec 14, 2022
Integrating the Best of TF into PyTorch, for Machine Learning, Natural Language Processing, and Text Generation. This is part of the CASL project: http://casl-project.ai/

Texar-PyTorch is a toolkit aiming to support a broad set of machine learning, especially natural language processing and text generation tasks. Texar

ASYML 726 Dec 30, 2022
Trains an OpenNMT PyTorch model and SentencePiece tokenizer.

Trains an OpenNMT PyTorch model and SentencePiece tokenizer. Designed for use with Argos Translate and LibreTranslate.

Argos Open Tech 61 Dec 13, 2022
p-tuning for few-shot NLU task

p-tuning_NLU Overview 这个小项目是受乐于分享的苏剑林大佬这篇p-tuning 文章启发,也实现了个使用P-tuning进行NLU分类的任务, 思路是一样的,prompt实现方式有不同,这里是将[unused*]的embeddings参数抽取出用于初始化prompt_embed后

3 Dec 29, 2022
Text Normalization(文本正则化)

Text Normalization(文本正则化) 任务描述:通过机器学习算法将英文文本的“手写”形式转换成“口语“形式,例如“6ft”转换成“six feet”等 实验结果 XGBoost + bag-of-words: 0.99159 XGBoost+Weights+rules:0.99002

Jason_Zhang 0 Feb 26, 2022
QVHighlights: Detecting Moments and Highlights in Videos via Natural Language Queries

Moment-DETR QVHighlights: Detecting Moments and Highlights in Videos via Natural Language Queries Jie Lei, Tamara L. Berg, Mohit Bansal For dataset de

Jie Lei 雷杰 133 Dec 22, 2022
A fast, efficient universal vector embedding utility package.

Magnitude: a fast, simple vector embedding utility library A feature-packed Python package and vector storage file format for utilizing vector embeddi

Plasticity 1.5k Jan 02, 2023
Chinese version of GPT2 training code, using BERT tokenizer.

GPT2-Chinese Description Chinese version of GPT2 training code, using BERT tokenizer or BPE tokenizer. It is based on the extremely awesome repository

Zeyao Du 5.6k Jan 04, 2023