Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
/ segment Public

A tool to segment text based on frequencies and the Viterbi algorithm "#TheBoyWhoLived" => ['#', 'The', 'Boy', 'Who', 'Lived']

Notifications You must be signed in to change notification settings

willf/segment

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This module segments text according word frequency using the Viterbi algorithm. Probably due to Peter Norvig somehow.

Three sources of frequency information is provided.

One is from the Google NGram corpus, a general web corpus.

The second is from the Rovereto Twitter N-Gram Corpus, which is better for some Twitter data.

The third is from a webcrawl dataset of anchor text provided by Vinay Goel of the Internet Archive.

> from segment.segmenter import Analyzer
> e = Analyzer('en')
> e.segment("AbeLincoln")
['Abe', 'Lincoln']
> e.segment("BieberHeartsBeliebers")
['Bi', 'e', 'ber', 'Hearts', 'Be', 'lieber', 's']
> t = Analyzer('twitter')
> t.segment("BieberHeartsBeliebers")
['Bieber', 'Hearts', 'Beliebers']
> t = Analyzer('anchor')
> t.segment("wordpress&sex")
['wordpress', '&', 'sex']

About

A tool to segment text based on frequencies and the Viterbi algorithm "#TheBoyWhoLived" => ['#', 'The', 'Boy', 'Who', 'Lived']

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.