Crypto Like

Crypto Like

1609316266

What is Glitch Finance (GLCH) | What is GLCH token

Glitch (GLCH) is a blockchain agnostic super protocol, purpose built to facilitate trust-less money markets.itch is a blockchain agnostic super protocol, purpose built to facilitate trust-less money markets.

GLITCH is developing a brand new blockchain dedicated to decentralised financial products and built with scaling and profit sharing at its core. The Protocol offers high transaction throughput, near-zero transaction fees and a profit sharing model that is appealing to investors, dApp developers and end users. GLITCH is led by a team of seasoned blockchain professionals and prominent advisors who have come together to deliver a new breed of DeFi “Operating Software” free from the shortcomings of existing chains.

Profit-Sharing Vault Model

By default, 20% of all network fees and revenues from dApps are deposited into a network vault stored on the GLITCH Protocol. Tokens from the Vault are then shared to all GLITCH stakers supporting the networks computation requisites. This model fosters community support for GLITCH dApps by giving coin holders financial incentives to help dApp developers generate revenue. This creates a positive feedback loop in which developers can count on community support and coin holders are rewarded with tokens that can then be spent through dApps across the GLITCH network.

Image for post

Decentralised Exchange

GLITCH bridges the gap with existing blockchains, by allowing external tokens to be wrapped and imported into the GLITCH Ecosystem. To ensure price discovery, transparent market information and efficient resource allocation, all assets living on top of the GLITCH protocol will be tradeable via a fully decentralised peer-to-peer exchange incorporating the state of the art technology with regards to liquidity provision and market-making.

Image for post

Unified Token Framework

For decentralized finance to flourish, there must be a single token that unites an entire ecosystem of dApps. That is the rationale behind GLITCH, which offers a unified blockchain operating system on which third-party developers can build dApps for decentralized finance. All dApps built on GLITCH will use a single token for transactions and governance, ensuring cohesion across all of the various dApps for decentralized finance within the ecosystem.

Image for post

GLITCH Public Token Offering Execution

GLITCH Public Token Offering will be executed by leveraging the TrustSwap Launchpad. Immediately upon the conclusion of the offering, a Uniswap pool will be created, and exchanging can commence for $GLCH tokens.

Alongside the offering, a Liquidity Staking Rewards program will go live for participation through the use of the LP token of the Uniswap GLCH/ETH pair, with the first incentives program running for 3 months.

TrustSwap is a company whose ideals run parallel to GLITCH’s. Over the past three years, their well-known founding team members have all owned and operated companies, including other token networks, advisory companies, and blockchain development firms in the cryptocurrency space. Their financial applications never compromise on security and are arguably the safest option for companies and users to participate in Decentralized Finance.

TrustSwap technology utilizes simple and secure peer-to-peer transactions, via TrustSwap SmartLaunch™, which ensures that GLITCH and its participants can transact securely and without the fear of participants or team members negatively impacting the markets following the public offering. TrustSwap’s Time-based SmartLock™ ensures a methodical distribution to mitigate the risk of unauthorized token transfers.

GLITCH will use TrustSwap for:

  • Team token vesting
  • Token holder vesting
  • Liquidity locks

1% of $GLCH total supply will be airdropped to the top 1,000 ‘Swap Scores’ (Average Swap staked over the most recent sixty days).

The snapshot is taken on the day of the Launchpad offering, therefore, if you are outside the top 1,000, you still have ample time to build your score to be eligible. To figure out how much you need, use the  leaderboard and  calculator.

0.5% of the total supply will go to the TrustSwap Foundation Fund.

Offering Details

  • Initial Marketcap: $1.36M
  • Price per token: $0.09
  • Fully unlocked tokens on day one
  • Raise Hardcap: $1.2M
  • Total Supply: 88,888,888 GLCH

Tokens from the public sale on the TrustSwap launchpad are 100% available on day one of launch. All other previous sales are subject to vesting.

Liquidity: Uniswap LP will be seeded and a liquidity rewards campaign will be started within the first week of the sale completion. 1% of GLCH tokens will be rewarded over the first 3 months for Uniswap LP providers. Image for post

Vesting

Week 1: 17.083% will be circulating and unlocked. 15% for the Public Sale + 2% for Marketing + liquidity rewards.

Week 2: Seed + Private 1 + Private 2 begin to unlock. There is weekly vesting for each round according to the chart and table below. Image for post

Team: Locked for 3 months, then quarterly vesting for 12 months.

Advisors: Locked for 3 months, then vesting for 6 months.

Allocations

  • Staking 3,000 SWAP guarantees you an allocation to the glitch token sale, pending jurisdictional restrictions.
  • Those with a Swap Score of 20k+ will get 1.5X allocation
  • Those with a Swap Score of 50k+ will get a 2X allocation

Swap Score is your average Swap staked over the most recent sixty days.

Process

On Monday, January 11th, at 6:00 AM PST, head to  https://launchpad.trustswap.org/.

Go through the steps listed, and upload your documents.

After twelve hours, the portal will close. There will be a waiting period of up to 48 hours as the GLITCH team finalizes internal processes. If your application is successful, you will receive an email indicating how much you are able to contribute to the token offering. You will have 24 hours to send the funds, or your position will be given up

Would you like to earn many tokens and cryptocurrencies right now! ☞ CLICK HERE

Looking for more information…

☞ Website
☞ Announcement
☞ Whitepaper
☞ Social Channel
Message Board
☞ Documentation

Create an Account and Trade Cryptocurrency NOW

Binance
Bittrex
Poloniex

Thank for visiting and reading this article! I’m highly appreciate your actions! Please share if you liked it!

#bitcoin #crypto #glitch finance #glch

What is GEEK

Buddha Community

What is Glitch Finance (GLCH) | What is GLCH token
Crypto Like

Crypto Like

1609316266

What is Glitch Finance (GLCH) | What is GLCH token

Glitch (GLCH) is a blockchain agnostic super protocol, purpose built to facilitate trust-less money markets.itch is a blockchain agnostic super protocol, purpose built to facilitate trust-less money markets.

GLITCH is developing a brand new blockchain dedicated to decentralised financial products and built with scaling and profit sharing at its core. The Protocol offers high transaction throughput, near-zero transaction fees and a profit sharing model that is appealing to investors, dApp developers and end users. GLITCH is led by a team of seasoned blockchain professionals and prominent advisors who have come together to deliver a new breed of DeFi “Operating Software” free from the shortcomings of existing chains.

Profit-Sharing Vault Model

By default, 20% of all network fees and revenues from dApps are deposited into a network vault stored on the GLITCH Protocol. Tokens from the Vault are then shared to all GLITCH stakers supporting the networks computation requisites. This model fosters community support for GLITCH dApps by giving coin holders financial incentives to help dApp developers generate revenue. This creates a positive feedback loop in which developers can count on community support and coin holders are rewarded with tokens that can then be spent through dApps across the GLITCH network.

Image for post

Decentralised Exchange

GLITCH bridges the gap with existing blockchains, by allowing external tokens to be wrapped and imported into the GLITCH Ecosystem. To ensure price discovery, transparent market information and efficient resource allocation, all assets living on top of the GLITCH protocol will be tradeable via a fully decentralised peer-to-peer exchange incorporating the state of the art technology with regards to liquidity provision and market-making.

Image for post

Unified Token Framework

For decentralized finance to flourish, there must be a single token that unites an entire ecosystem of dApps. That is the rationale behind GLITCH, which offers a unified blockchain operating system on which third-party developers can build dApps for decentralized finance. All dApps built on GLITCH will use a single token for transactions and governance, ensuring cohesion across all of the various dApps for decentralized finance within the ecosystem.

Image for post

GLITCH Public Token Offering Execution

GLITCH Public Token Offering will be executed by leveraging the TrustSwap Launchpad. Immediately upon the conclusion of the offering, a Uniswap pool will be created, and exchanging can commence for $GLCH tokens.

Alongside the offering, a Liquidity Staking Rewards program will go live for participation through the use of the LP token of the Uniswap GLCH/ETH pair, with the first incentives program running for 3 months.

TrustSwap is a company whose ideals run parallel to GLITCH’s. Over the past three years, their well-known founding team members have all owned and operated companies, including other token networks, advisory companies, and blockchain development firms in the cryptocurrency space. Their financial applications never compromise on security and are arguably the safest option for companies and users to participate in Decentralized Finance.

TrustSwap technology utilizes simple and secure peer-to-peer transactions, via TrustSwap SmartLaunch™, which ensures that GLITCH and its participants can transact securely and without the fear of participants or team members negatively impacting the markets following the public offering. TrustSwap’s Time-based SmartLock™ ensures a methodical distribution to mitigate the risk of unauthorized token transfers.

GLITCH will use TrustSwap for:

  • Team token vesting
  • Token holder vesting
  • Liquidity locks

1% of $GLCH total supply will be airdropped to the top 1,000 ‘Swap Scores’ (Average Swap staked over the most recent sixty days).

The snapshot is taken on the day of the Launchpad offering, therefore, if you are outside the top 1,000, you still have ample time to build your score to be eligible. To figure out how much you need, use the  leaderboard and  calculator.

0.5% of the total supply will go to the TrustSwap Foundation Fund.

Offering Details

  • Initial Marketcap: $1.36M
  • Price per token: $0.09
  • Fully unlocked tokens on day one
  • Raise Hardcap: $1.2M
  • Total Supply: 88,888,888 GLCH

Tokens from the public sale on the TrustSwap launchpad are 100% available on day one of launch. All other previous sales are subject to vesting.

Liquidity: Uniswap LP will be seeded and a liquidity rewards campaign will be started within the first week of the sale completion. 1% of GLCH tokens will be rewarded over the first 3 months for Uniswap LP providers. Image for post

Vesting

Week 1: 17.083% will be circulating and unlocked. 15% for the Public Sale + 2% for Marketing + liquidity rewards.

Week 2: Seed + Private 1 + Private 2 begin to unlock. There is weekly vesting for each round according to the chart and table below. Image for post

Team: Locked for 3 months, then quarterly vesting for 12 months.

Advisors: Locked for 3 months, then vesting for 6 months.

Allocations

  • Staking 3,000 SWAP guarantees you an allocation to the glitch token sale, pending jurisdictional restrictions.
  • Those with a Swap Score of 20k+ will get 1.5X allocation
  • Those with a Swap Score of 50k+ will get a 2X allocation

Swap Score is your average Swap staked over the most recent sixty days.

Process

On Monday, January 11th, at 6:00 AM PST, head to  https://launchpad.trustswap.org/.

Go through the steps listed, and upload your documents.

After twelve hours, the portal will close. There will be a waiting period of up to 48 hours as the GLITCH team finalizes internal processes. If your application is successful, you will receive an email indicating how much you are able to contribute to the token offering. You will have 24 hours to send the funds, or your position will be given up

Would you like to earn many tokens and cryptocurrencies right now! ☞ CLICK HERE

Looking for more information…

☞ Website
☞ Announcement
☞ Whitepaper
☞ Social Channel
Message Board
☞ Documentation

Create an Account and Trade Cryptocurrency NOW

Binance
Bittrex
Poloniex

Thank for visiting and reading this article! I’m highly appreciate your actions! Please share if you liked it!

#bitcoin #crypto #glitch finance #glch

Angelina roda

Angelina roda

1624219980

How to Buy NFT Art Finance Token - The EASIEST METHOD! DO NOT MISS!!! JUST IN 4 MINUTES

NFT Art Finance is currently one of the most popular cryptocurrencies right now on the market, so in today’s video, I will be showing you guys how to easily buy NFT Art Finance on your phone using the Trust Wallet application.
📺 The video in this post was made by More LimSanity
The origin of the article: https://www.youtube.com/watch?v=sKE6Pc_w1IE
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #nft art finance token #token #buy nft art finance #how to buy nft art finance token - the easiest method!

David mr

David mr

1624312800

SPORE FINANCE PREDICTION - WHAT IS SPORE FINANCE & SPORE FINANCE ANALYSIS - SPORE FINANCE

SPORE FINANCE PREDICTION - WHAT IS SPORE FINANCE & SPORE FINANCE ANALYSIS - SPORE FINANCE

In this video, I talk about spore finance coin and give my spore finance prediction. I talk about the latest spore finance analysis & spore finance crypto coin that recently has been hit pretty hard in the last 24 hours. I go over what is spore finance and how many holders are on this new crypto coin spore finance.
📺 The video in this post was made by Josh’s Finance
The origin of the article: https://www.youtube.com/watch?v=qbPQvdxCtEI
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #spore finance #what is spore finance #spore finance prediction - what is spore finance & spore finance analysis - spore finance #spore finance prediction

Words Counted: A Ruby Natural Language Processor.

WordsCounted

We are all in the gutter, but some of us are looking at the stars.

-- Oscar Wilde

WordsCounted is a Ruby NLP (natural language processor). WordsCounted lets you implement powerful tokensation strategies with a very flexible tokeniser class.

Are you using WordsCounted to do something interesting? Please tell me about it.

 

Demo

Visit this website for one example of what you can do with WordsCounted.

Features

  • Out of the box, get the following data from any string or readable file, or URL:
    • Token count and unique token count
    • Token densities, frequencies, and lengths
    • Char count and average chars per token
    • The longest tokens and their lengths
    • The most frequent tokens and their frequencies.
  • A flexible way to exclude tokens from the tokeniser. You can pass a string, regexp, symbol, lambda, or an array of any combination of those types for powerful tokenisation strategies.
  • Pass your own regexp rules to the tokeniser if you prefer. The default regexp filters special characters but keeps hyphens and apostrophes. It also plays nicely with diacritics (UTF and unicode characters): Bayrūt is treated as ["Bayrūt"] and not ["Bayr", "ū", "t"], for example.
  • Opens and reads files. Pass in a file path or a url instead of a string.

Installation

Add this line to your application's Gemfile:

gem 'words_counted'

And then execute:

$ bundle

Or install it yourself as:

$ gem install words_counted

Usage

Pass in a string or a file path, and an optional filter and/or regexp.

counter = WordsCounted.count(
  "We are all in the gutter, but some of us are looking at the stars."
)

# Using a file
counter = WordsCounted.from_file("path/or/url/to/my/file.txt")

.count and .from_file are convenience methods that take an input, tokenise it, and return an instance of WordsCounted::Counter initialized with the tokens. The WordsCounted::Tokeniser and WordsCounted::Counter classes can be used alone, however.

API

WordsCounted

WordsCounted.count(input, options = {})

Tokenises input and initializes a WordsCounted::Counter object with the resulting tokens.

counter = WordsCounted.count("Hello Beirut!")

Accepts two options: exclude and regexp. See Excluding tokens from the analyser and Passing in a custom regexp respectively.

WordsCounted.from_file(path, options = {})

Reads and tokenises a file, and initializes a WordsCounted::Counter object with the resulting tokens.

counter = WordsCounted.from_file("hello_beirut.txt")

Accepts the same options as .count.

Tokeniser

The tokeniser allows you to tokenise text in a variety of ways. You can pass in your own rules for tokenisation, and apply a powerful filter with any combination of rules as long as they can boil down into a lambda.

Out of the box the tokeniser includes only alpha chars. Hyphenated tokens and tokens with apostrophes are considered a single token.

#tokenise([pattern: TOKEN_REGEXP, exclude: nil])

tokeniser = WordsCounted::Tokeniser.new("Hello Beirut!").tokenise

# With `exclude`
tokeniser = WordsCounted::Tokeniser.new("Hello Beirut!").tokenise(exclude: "hello")

# With `pattern`
tokeniser = WordsCounted::Tokeniser.new("I <3 Beirut!").tokenise(pattern: /[a-z]/i)

See Excluding tokens from the analyser and Passing in a custom regexp for more information.

Counter

The WordsCounted::Counter class allows you to collect various statistics from an array of tokens.

#token_count

Returns the token count of a given string.

counter.token_count #=> 15

#token_frequency

Returns a sorted (unstable) two-dimensional array where each element is a token and its frequency. The array is sorted by frequency in descending order.

counter.token_frequency

[
  ["the", 2],
  ["are", 2],
  ["we",  1],
  # ...
  ["all", 1]
]

#most_frequent_tokens

Returns a hash where each key-value pair is a token and its frequency.

counter.most_frequent_tokens

{ "are" => 2, "the" => 2 }

#token_lengths

Returns a sorted (unstable) two-dimentional array where each element contains a token and its length. The array is sorted by length in descending order.

counter.token_lengths

[
  ["looking", 7],
  ["gutter",  6],
  ["stars",   5],
  # ...
  ["in",      2]
]

#longest_tokens

Returns a hash where each key-value pair is a token and its length.

counter.longest_tokens

{ "looking" => 7 }

#token_density([ precision: 2 ])

Returns a sorted (unstable) two-dimentional array where each element contains a token and its density as a float, rounded to a precision of two. The array is sorted by density in descending order. It accepts a precision argument, which must be a float.

counter.token_density

[
  ["are",     0.13],
  ["the",     0.13],
  ["but",     0.07 ],
  # ...
  ["we",      0.07 ]
]

#char_count

Returns the char count of tokens.

counter.char_count #=> 76

#average_chars_per_token([ precision: 2 ])

Returns the average char count per token rounded to two decimal places. Accepts a precision argument which defaults to two. Precision must be a float.

counter.average_chars_per_token #=> 4

#uniq_token_count

Returns the number of unique tokens.

counter.uniq_token_count #=> 13

Excluding tokens from the tokeniser

You can exclude anything you want from the input by passing the exclude option. The exclude option accepts a variety of filters and is extremely flexible.

  1. A space-delimited string. The filter will normalise the string.
  2. A regular expression.
  3. A lambda.
  4. A symbol that names a predicate method. For example :odd?.
  5. An array of any combination of the above.
tokeniser =
  WordsCounted::Tokeniser.new(
    "Magnificent! That was magnificent, Trevor."
  )

# Using a string
tokeniser.tokenise(exclude: "was magnificent")
# => ["that", "trevor"]

# Using a regular expression
tokeniser.tokenise(exclude: /trevor/)
# => ["magnificent", "that", "was", "magnificent"]

# Using a lambda
tokeniser.tokenise(exclude: ->(t) { t.length < 4 })
# => ["magnificent", "that", "magnificent", "trevor"]

# Using symbol
tokeniser = WordsCounted::Tokeniser.new("Hello! محمد")
tokeniser.tokenise(exclude: :ascii_only?)
# => ["محمد"]

# Using an array
tokeniser = WordsCounted::Tokeniser.new(
  "Hello! اسماءنا هي محمد، كارولينا، سامي، وداني"
)
tokeniser.tokenise(
  exclude: [:ascii_only?, /محمد/, ->(t) { t.length > 6}, "و"]
)
# => ["هي", "سامي", "وداني"]

Passing in a custom regexp

The default regexp accounts for letters, hyphenated tokens, and apostrophes. This means twenty-one is treated as one token. So is Mohamad's.

/[\p{Alpha}\-']+/

You can pass your own criteria as a Ruby regular expression to split your string as desired.

For example, if you wanted to include numbers, you can override the regular expression:

counter = WordsCounted.count("Numbers 1, 2, and 3", pattern: /[\p{Alnum}\-']+/)
counter.tokens
#=> ["numbers", "1", "2", "and", "3"]

Opening and reading files

Use the from_file method to open files. from_file accepts the same options as .count. The file path can be a URL.

counter = WordsCounted.from_file("url/or/path/to/file.text")

Gotchas

A hyphen used in leu of an em or en dash will form part of the token. This affects the tokeniser algorithm.

counter = WordsCounted.count("How do you do?-you are well, I see.")
counter.token_frequency

[
  ["do",   2],
  ["how",  1],
  ["you",  1],
  ["-you", 1], # WTF, mate!
  ["are",  1],
  # ...
]

In this example -you and you are separate tokens. Also, the tokeniser does not include numbers by default. Remember that you can pass your own regular expression if the default behaviour does not fit your needs.

A note on case sensitivity

The program will normalise (downcase) all incoming strings for consistency and filters.

Roadmap

Ability to open URLs

def self.from_url
  # open url and send string here after removing html
end

Contributors

See contributors.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author: abitdodgy
Source code: https://github.com/abitdodgy/words_counted
License: MIT license

#ruby  #ruby-on-rails 

Royce  Reinger

Royce Reinger

1658068560

WordsCounted: A Ruby Natural Language Processor

WordsCounted

We are all in the gutter, but some of us are looking at the stars.

-- Oscar Wilde

WordsCounted is a Ruby NLP (natural language processor). WordsCounted lets you implement powerful tokensation strategies with a very flexible tokeniser class.

Features

  • Out of the box, get the following data from any string or readable file, or URL:
    • Token count and unique token count
    • Token densities, frequencies, and lengths
    • Char count and average chars per token
    • The longest tokens and their lengths
    • The most frequent tokens and their frequencies.
  • A flexible way to exclude tokens from the tokeniser. You can pass a string, regexp, symbol, lambda, or an array of any combination of those types for powerful tokenisation strategies.
  • Pass your own regexp rules to the tokeniser if you prefer. The default regexp filters special characters but keeps hyphens and apostrophes. It also plays nicely with diacritics (UTF and unicode characters): Bayrūt is treated as ["Bayrūt"] and not ["Bayr", "ū", "t"], for example.
  • Opens and reads files. Pass in a file path or a url instead of a string.

Installation

Add this line to your application's Gemfile:

gem 'words_counted'

And then execute:

$ bundle

Or install it yourself as:

$ gem install words_counted

Usage

Pass in a string or a file path, and an optional filter and/or regexp.

counter = WordsCounted.count(
  "We are all in the gutter, but some of us are looking at the stars."
)

# Using a file
counter = WordsCounted.from_file("path/or/url/to/my/file.txt")

.count and .from_file are convenience methods that take an input, tokenise it, and return an instance of WordsCounted::Counter initialized with the tokens. The WordsCounted::Tokeniser and WordsCounted::Counter classes can be used alone, however.

API

WordsCounted

WordsCounted.count(input, options = {})

Tokenises input and initializes a WordsCounted::Counter object with the resulting tokens.

counter = WordsCounted.count("Hello Beirut!")

Accepts two options: exclude and regexp. See Excluding tokens from the analyser and Passing in a custom regexp respectively.

WordsCounted.from_file(path, options = {})

Reads and tokenises a file, and initializes a WordsCounted::Counter object with the resulting tokens.

counter = WordsCounted.from_file("hello_beirut.txt")

Accepts the same options as .count.

Tokeniser

The tokeniser allows you to tokenise text in a variety of ways. You can pass in your own rules for tokenisation, and apply a powerful filter with any combination of rules as long as they can boil down into a lambda.

Out of the box the tokeniser includes only alpha chars. Hyphenated tokens and tokens with apostrophes are considered a single token.

#tokenise([pattern: TOKEN_REGEXP, exclude: nil])

tokeniser = WordsCounted::Tokeniser.new("Hello Beirut!").tokenise

# With `exclude`
tokeniser = WordsCounted::Tokeniser.new("Hello Beirut!").tokenise(exclude: "hello")

# With `pattern`
tokeniser = WordsCounted::Tokeniser.new("I <3 Beirut!").tokenise(pattern: /[a-z]/i)

See Excluding tokens from the analyser and Passing in a custom regexp for more information.

Counter

The WordsCounted::Counter class allows you to collect various statistics from an array of tokens.

#token_count

Returns the token count of a given string.

counter.token_count #=> 15

#token_frequency

Returns a sorted (unstable) two-dimensional array where each element is a token and its frequency. The array is sorted by frequency in descending order.

counter.token_frequency

[
  ["the", 2],
  ["are", 2],
  ["we",  1],
  # ...
  ["all", 1]
]

#most_frequent_tokens

Returns a hash where each key-value pair is a token and its frequency.

counter.most_frequent_tokens

{ "are" => 2, "the" => 2 }

#token_lengths

Returns a sorted (unstable) two-dimentional array where each element contains a token and its length. The array is sorted by length in descending order.

counter.token_lengths

[
  ["looking", 7],
  ["gutter",  6],
  ["stars",   5],
  # ...
  ["in",      2]
]

#longest_tokens

Returns a hash where each key-value pair is a token and its length.

counter.longest_tokens

{ "looking" => 7 }

#token_density([ precision: 2 ])

Returns a sorted (unstable) two-dimentional array where each element contains a token and its density as a float, rounded to a precision of two. The array is sorted by density in descending order. It accepts a precision argument, which must be a float.

counter.token_density

[
  ["are",     0.13],
  ["the",     0.13],
  ["but",     0.07 ],
  # ...
  ["we",      0.07 ]
]

#char_count

Returns the char count of tokens.

counter.char_count #=> 76

#average_chars_per_token([ precision: 2 ])

Returns the average char count per token rounded to two decimal places. Accepts a precision argument which defaults to two. Precision must be a float.

counter.average_chars_per_token #=> 4

#uniq_token_count

Returns the number of unique tokens.

counter.uniq_token_count #=> 13

Excluding tokens from the tokeniser

You can exclude anything you want from the input by passing the exclude option. The exclude option accepts a variety of filters and is extremely flexible.

  1. A space-delimited string. The filter will normalise the string.
  2. A regular expression.
  3. A lambda.
  4. A symbol that names a predicate method. For example :odd?.
  5. An array of any combination of the above.
tokeniser =
  WordsCounted::Tokeniser.new(
    "Magnificent! That was magnificent, Trevor."
  )

# Using a string
tokeniser.tokenise(exclude: "was magnificent")
# => ["that", "trevor"]

# Using a regular expression
tokeniser.tokenise(exclude: /trevor/)
# => ["magnificent", "that", "was", "magnificent"]

# Using a lambda
tokeniser.tokenise(exclude: ->(t) { t.length < 4 })
# => ["magnificent", "that", "magnificent", "trevor"]

# Using symbol
tokeniser = WordsCounted::Tokeniser.new("Hello! محمد")
tokeniser.tokenise(exclude: :ascii_only?)
# => ["محمد"]

# Using an array
tokeniser = WordsCounted::Tokeniser.new(
  "Hello! اسماءنا هي محمد، كارولينا، سامي، وداني"
)
tokeniser.tokenise(
  exclude: [:ascii_only?, /محمد/, ->(t) { t.length > 6}, "و"]
)
# => ["هي", "سامي", "وداني"]

Passing in a custom regexp

The default regexp accounts for letters, hyphenated tokens, and apostrophes. This means twenty-one is treated as one token. So is Mohamad's.

/[\p{Alpha}\-']+/

You can pass your own criteria as a Ruby regular expression to split your string as desired.

For example, if you wanted to include numbers, you can override the regular expression:

counter = WordsCounted.count("Numbers 1, 2, and 3", pattern: /[\p{Alnum}\-']+/)
counter.tokens
#=> ["numbers", "1", "2", "and", "3"]

Opening and reading files

Use the from_file method to open files. from_file accepts the same options as .count. The file path can be a URL.

counter = WordsCounted.from_file("url/or/path/to/file.text")

Gotchas

A hyphen used in leu of an em or en dash will form part of the token. This affects the tokeniser algorithm.

counter = WordsCounted.count("How do you do?-you are well, I see.")
counter.token_frequency

[
  ["do",   2],
  ["how",  1],
  ["you",  1],
  ["-you", 1], # WTF, mate!
  ["are",  1],
  # ...
]

In this example -you and you are separate tokens. Also, the tokeniser does not include numbers by default. Remember that you can pass your own regular expression if the default behaviour does not fit your needs.

A note on case sensitivity

The program will normalise (downcase) all incoming strings for consistency and filters.

Roadmap

Ability to open URLs

def self.from_url
  # open url and send string here after removing html
end

Are you using WordsCounted to do something interesting? Please tell me about it.

Gem Version 

RubyDoc documentation.

Demo

Visit this website for one example of what you can do with WordsCounted.


Contributors

See contributors.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author: Abitdodgy
Source Code: https://github.com/abitdodgy/words_counted 
License: MIT license

#ruby #nlp