Git Product home page Git Product logo

twitter-text-rb's Introduction

twitter-text

A gem that provides text processing routines for Twitter Tweets. The major reason for this is to unify the various auto-linking and extraction of usernames, lists, hashtags and URLs.

Extraction Examples

# Extraction
class MyClass
  include Twitter::Extractor
  usernames = extract_mentioned_screen_names("Mentioning @twitter and @jack")
  # usernames = ["twitter", "jack"]
end

# Extraction with a block argument
class MyClass
  include Twitter::Extractor
  extract_reply_screen_name("@twitter are you hiring?").do |username|
    # username = "twitter"
  end
end

Auto-linking Examples

# Auto-link
class MyClass
  include Twitter::Autolink

  html = auto_link("link @user, please #request")
end

Usernames

Username extraction and linking matches all valid Twitter usernames but does not verify that the username is a valid Twitter account.

Lists

Auto-link and extract list names when they are written in @user/list-name format.

Hashtags

Auto-link and extract hashtags, where a hashtag contains any latin letter or number but cannot be solely numbers.

URLs

Auto-linking and extraction of URLs differs from the Rails default so that it will work correctly in Tweets written in languages that do not include spaces between words.

International

Special care has been taken to be sure that auto-linking and extraction work in Tweets of all languages. This means that languages without spaces between words should work equally well.

Hit Highlighting

Use to provide emphasis around the “hits” returned from the Search API, built to work against text that has been auto-linked already.

Conformance

To run the Conformance suite, you’ll need to add that project as a git submodule. From the root twitter-text-rb directory, run:

git submodule add [email protected]:mzsanford/twitter-text-conformance.git test/twitter-text-conformance/
git submodule init
git submodule update

Thanks

Thanks to everybody who has filed issues, provided feedback or contibuted patches. Patches coutresy of:

twitter-text-rb's People

Contributors

hoverbird avatar bcherry avatar jpbougie avatar

Stargazers

Thomas Haggett avatar Jonathan del Strother avatar

Watchers

Jonathan del Strother avatar James Cloos 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.