Giter Site home page Giter Site logo

shahzebali42 / semantic-text-segmentation-with-embeddings Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reemhal/semantic-text-segmentation-with-embeddings

0.0 0.0 0.0 40 KB

Uses GloVe embeddings and greedy sequence segmentation to semantically segment a text document into any number of k segments.

Python 6.07% Jupyter Notebook 93.93%

semantic-text-segmentation-with-embeddings's Introduction

Semantic Text Segmentation with Embeddings

Given a text document d and a desired number of segments k, this repo shows how to segment the document into k semantically homoginuous segments.

The general approach is as follows:

  1. Convert the words in d into embedding vectors using the GloVe model.
  2. For all word sequences s in d: the average meaning (centroid) of s is represented by taking the average embeddings of all words in s.
  3. The error in the centroid calculation for a sequence s is calculated as the average cosine distance between the centroid and all words in s.
  4. The segmentation is done using the greedy heuristic by iteratively choosing the best split point p.

The class text_segmentation_class in text_segmetnation.py contains funtions to convert the document words in GloVe embeddings and choose the splitting points. The notebook semantc_text_segmentation_example.ipynb demonstrates how to use the class.

Technologies

This project was developed using:

  • python=3.5
  • gensim==3.7.1
  • matplotlib==2.2.3
  • mpld3==0.3
  • nltk==3.4
  • numpy==1.14.5
  • pandas==0.23.4
  • parso==0.3.1
  • Pillow==5.2.0
  • scikit-learn==0.19.2
  • scipy==1.1.0

semantic-text-segmentation-with-embeddings's People

Contributors

reemhal avatar

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.