Giter Club home page Giter Club logo

hekeda-ban / topicsketch Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 293 KB

This is a simple implementation of the paper "TopicSketch: Real-Time Bursty Topic Detection from Twitter" http://ieeexplore.ieee.org/document/7457245/?reload=true&arnumber=7457245&filter%3DAND(p_IS_Number:7505473) This project is mainly coded using python, while for the reason of efficiency, some core parts are implemented using C and Cython.

License: Apache License 2.0

C 1.72% Cython 7.81% Python 90.46%
bursty-topic-detection

topicsketch's Introduction

TopicSketch

This is a simple implementation of the paper "TopicSketch: Real-Time Bursty Topic Detection from Twitter" http://ieeexplore.ieee.org/document/7457245/?reload=true&arnumber=7457245&filter%3DAND(p_IS_Number:7505473)

This project is mainly coded using python, while for the reason of efficiency, some core parts are implemented using C and Cython.

Getting Started

Data Flow

The data flow is as follows. (See main.py.)

stream ==> preprocessor ==> detection component ==> topicsketch ==> detected topic

Stream

In order to run TopicSketch, a stream class is needed. It should extend topicsketch.stream.ItemStream . Everytime, TopicSketch will call stream.next() to get the next tweet. Each tweet is represented as a tuple (timestamp, user_id, tweet_text). experiment.tweet_stream is an example, which get tweets from a MySQL database.

Notice: make sure the tweet stream in the order of time !!!

Tokenization

In this project, I use twokenize (https://github.com/myleott/ark-twokenize-py) for tokenization. For different languages, other tokenizer may be used.

Compile

For hashing

hash.c is an implementation of the multi-linear family hash function.

cd c; gcc -fPIC -shared -o mlh.so hash.c

For acceleration and significance score

acceleration is defined in the above paper "TopicSketch".

significance score is defined in the paper "SigniTrend: scalable detection of emerging topics in textual streams by hashed significance thresholds".

install Cython first: pip install cython

cd cython

cd fast_smoother; python setup.py build_ext --inplace

cd fast_signi; python setup.py build_ext --inplace

After compiling, copy the libraries into folder TopicSketch.

Stop Words

Put stop words in twitter-stopwords.txt. Define your own stop words file according to your data set.

Parameters

Set parameters in file "parameters.cnf". At least set start_t and end_t under section [detection].

Memory

It is suggested to use a machine which has enough memory (>=16GB).

Detection Threshold

It is suggested to set high threshold for reliable results.

Spam

It is suggested to remove spam accounts from the data set before running the detection algorithm.

Scipy

Update scipy to the latest version for best computational performance.

Running the Program

Once you implement your stream class, replace tweet_stream in main.py by your stream. Then run main.py. Debugging information will appear in the CLI. Detected topics will be saved in file results.txt.

本程序目前可以跑通,调了好长时间,但是最终没有获取到results.txt文件里的内容,也就是最终没有检测出来的突发主题。

希望给做这个方向的人士提供一些帮助。

也希望有人可以调出结果。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.