1624870277
In this article, we’ll discuss information about the Solrise Finance project and SLRS token
Solrise Finance is a decentralized, trustless, and non-custodial asset management platform built on Solana. Solrise allows anyone to start or invest in a fund with as little as $20.
Solrise was established in response to personal frustrations about Robinhood’s centralized decision to halt all trading of GME stock - the team realized that there was no effective way for retail investors to invest small amounts on ETH based asset management platforms due to the high transaction fees.
At Solrise Finance, we’re building a protocol for creating and running decentralized, trust-minimized investment funds on the Solana blockchain.
With Solrise, managers will be able to create funds that include asset classes from across the Solana ecosystem and beyond — we intend to integrate with every DeFi protocol that can expand the pool of assets available. Investors will be able to explore and track the performance of funds across the platform in detail — both historically and in real time — before deciding where to invest, with an extremely low barrier to entry.
We want Solrise to be positioned in the middle of the Solana ecosystem as the best way for those who have untapped asset management potential to realize it, and for the rest of us — busy, lazy, or just not financial geniuses — the best way to get great returns from excess investment capital.
Compared to existing decentralized fund models operating on the Ethereum blockchain, we can reduce the cost of basic operations from hundreds of dollars to cents at most, alongside dramatically faster trading speeds. Solana offers unparalleled low latency and transaction costs alongside full decentralization. It’s the natural home for a platform of this kind.
The Solrise team itself has been building hard on Solana for quite a while. We previously built both https://solflare.com/ and https://solanabeach.io/, so we’re confident we have the skills to execute both fast and well.
The Solrise protocol allows anyone to create an Investment Fund and act as a Manager of said fund. The Investment Fund holds a pool of assets — supporting any SPL tokens that exist on the Solana blockchain. The protocol currently supports native and wrapped assets, but we will be expanding this to include more generalized asset classes soon.
We’ll achieve this by onboarding price oracles — initially performed by the team, later through protocol governance. We intend to generalize our definition of “assets” to include anything that has a determined price — synthetic assets, stocks, inverses, asset buckets and even other funds.
The protocol currently permits a single Manager key to perform trades with integrated platforms on behalf of fund investors without the possibility of exiting the funds. In the future, we plan to add a pluggable governance module, allowing for fine-grained access control of investors as well as constraints on the form of whitelisted protocols and assets the fund is allowed to perform and interact with.
At Solrise, we want to enable anyone to run or invest in decentralized funds. In practice, creating a DeFi fund platform “for everyone” means keeping transaction fees and entry fees (that is, the cost of investing in a fund) down as much as possible — an increasingly significant challenge in the modern crypto landscape, as anyone who has recently sent an ETH TX and paid $30 for it knows.
Ethereum is very much here to stay, with tens of thousands of active projects and a bright future — but it’s a terrible fit for a decentralized fund platform of this kind. Creating a Solrise style fund on Ethereum means an initial fee of approximately $500 in gas due to storage costs, alongside an $250+ fee for investor entry and even higher fees for exit. Managers can find themselves paying $150+ every time they rearrange assets.
This just isn’t good enough for our customers. We can’t make our product an universal offering when investors need to be putting in tens of thousands at once to justify the loss to fees, and we can’t provide a competitive environment for our fund managers when they’re paying hundreds of dollars for trades that take half a minute. These fees disincentivize managers from active trading, pushing them towards moving their portfolios around once every few days at most, and restrict investment to those who are able to pay onerous fees.
Luckily — the future is multi chain. Enter Solana.
Solana provides a truly high-performance blockchain architecture that offers currently unparalleled transaction speed and costs. Solana can scale up to 50k transactions per second without an issue (versus Ethereum’s 15) and offers costs that are multiple orders of magnitude lower than the competition. In practice, this means our users can enter or exit funds for an effective cost of around $0.001, and trades are confirmed within moments.
We’ve been building on Solana for the past year — in fact, we previously built both Solflare and Solana Beach — so we know as well as anyone what builders can do on Solana, and we’re very confident about it. We believe that Solana is perfectly adapted to become the third blockchain to hit true widespread adoption after Ether and BTC. BTC has adapted to become a long-term store of value with low trading frequency, whereas Ether has become a natural “clearing house” — an intermediary station for high-value trades and settlement.
Solana provides a crucial alternative offering — that is, a platform naturally adapted for high-frequency activity at low cost, with cross-chain integrations that allow access to key assets from across the crypto universe. Solana’s bidirectional token bridge, Wormhole, is now in the process of active rollout and allows tokenized assets to be transferred directly from Ethereum to Solana — meaning Solana has access to every notable ERC20, alongside the thousands more that nobody cares about.
The Solana ecosystem is growing rapidly, with some very strong integrations available. Serum and its extensive cross-chain functionality will allow us to offer multiple top tokens including BTC, ETH, and USDC at launch. Recent winners of the Solana x Serum DeFi hackathon include Mango Markets, who offer leveraged trading, and Synthetify who are building out a synthetic asset protocol — key aspects of allowing us to offer a “hedge fund-like” set of tools for traders. If we’re able to integrate these services with Solrise, we’ll be able to offer an incredible diversity of assets and strategies to fund managers and investors — and is really just the start of what can be done with Solana.
The key to all this — transaction costs and technology aside — is that using Solana allows us to offer an unprecedented service to our users. With Solrise, anyone can start their own fund with setup and operating costs of close to 0, and anyone with a laptop and $500 can invest and reap the same level of returns that were previously reserved for high net worth individuals. Simply put, building on Solana allows us to offer a drastically better user experience than we could on any other blockchain.
SLRS has been listed on a number of crypto exchanges, unlike other main cryptocurrencies, it cannot be directly purchased with fiats money. However, You can still easily buy this coin by first buying Bitcoin, ETH, USDT, BNB from any large exchanges and then transfer to the exchange that offers to trade this coin, in this guide article we will walk you through in detail the steps to buy SLRS token.
You will have to first buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…
We will use Binance Exchange here as it is one of the largest crypto exchanges that accept fiat deposits.
Binance is a popular cryptocurrency exchange which was started in China but then moved their headquarters to the crypto-friendly Island of Malta in the EU. Binance is popular for its crypto to crypto exchange services. Binance exploded onto the scene in the mania of 2017 and has since gone on to become the top crypto exchange in the world.
Once you finished the KYC process. You will be asked to add a payment method. Here you can either choose to provide a credit/debit card or use a bank transfer, and buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…
Step by Step Guide : What is Binance | How to Create an account on Binance (Updated 2021)
Next step - Transfer your cryptos to an Altcoin Exchange
Since SLRS is an altcoin we need to transfer our coins to an exchange that SLRS can be traded. Below is a list of exchanges that offers to trade SLRS in various market pairs, head to their websites and register for an account.
Once finished you will then need to make a BTC/ETH/USDT/BNB deposit to the exchange from Binance depending on the available market pairs. After the deposit is confirmed you may then purchase SLRS from the exchange: FTX exchange
The top exchange for trading in SLRS token is currently FTX
Find more information SLRS
☞ Website ☞ Social Channel ☞ Social Channel 2 ☞ Social Channel 3 ☞ Message Board ☞ Coinmarketcap
🔺DISCLAIMER: The Information in the post isn’t financial advice, is intended FOR GENERAL INFORMATION PURPOSES ONLY. Trading Cryptocurrency 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)!
☞ **-----https://geekcash.org-----**⭐ ⭐ ⭐
Thank for visiting and reading this article! Please don’t forget to leave a like, comment and share!
#blockchain #bitcoin #slrs #solrise finance
1624870277
In this article, we’ll discuss information about the Solrise Finance project and SLRS token
Solrise Finance is a decentralized, trustless, and non-custodial asset management platform built on Solana. Solrise allows anyone to start or invest in a fund with as little as $20.
Solrise was established in response to personal frustrations about Robinhood’s centralized decision to halt all trading of GME stock - the team realized that there was no effective way for retail investors to invest small amounts on ETH based asset management platforms due to the high transaction fees.
At Solrise Finance, we’re building a protocol for creating and running decentralized, trust-minimized investment funds on the Solana blockchain.
With Solrise, managers will be able to create funds that include asset classes from across the Solana ecosystem and beyond — we intend to integrate with every DeFi protocol that can expand the pool of assets available. Investors will be able to explore and track the performance of funds across the platform in detail — both historically and in real time — before deciding where to invest, with an extremely low barrier to entry.
We want Solrise to be positioned in the middle of the Solana ecosystem as the best way for those who have untapped asset management potential to realize it, and for the rest of us — busy, lazy, or just not financial geniuses — the best way to get great returns from excess investment capital.
Compared to existing decentralized fund models operating on the Ethereum blockchain, we can reduce the cost of basic operations from hundreds of dollars to cents at most, alongside dramatically faster trading speeds. Solana offers unparalleled low latency and transaction costs alongside full decentralization. It’s the natural home for a platform of this kind.
The Solrise team itself has been building hard on Solana for quite a while. We previously built both https://solflare.com/ and https://solanabeach.io/, so we’re confident we have the skills to execute both fast and well.
The Solrise protocol allows anyone to create an Investment Fund and act as a Manager of said fund. The Investment Fund holds a pool of assets — supporting any SPL tokens that exist on the Solana blockchain. The protocol currently supports native and wrapped assets, but we will be expanding this to include more generalized asset classes soon.
We’ll achieve this by onboarding price oracles — initially performed by the team, later through protocol governance. We intend to generalize our definition of “assets” to include anything that has a determined price — synthetic assets, stocks, inverses, asset buckets and even other funds.
The protocol currently permits a single Manager key to perform trades with integrated platforms on behalf of fund investors without the possibility of exiting the funds. In the future, we plan to add a pluggable governance module, allowing for fine-grained access control of investors as well as constraints on the form of whitelisted protocols and assets the fund is allowed to perform and interact with.
At Solrise, we want to enable anyone to run or invest in decentralized funds. In practice, creating a DeFi fund platform “for everyone” means keeping transaction fees and entry fees (that is, the cost of investing in a fund) down as much as possible — an increasingly significant challenge in the modern crypto landscape, as anyone who has recently sent an ETH TX and paid $30 for it knows.
Ethereum is very much here to stay, with tens of thousands of active projects and a bright future — but it’s a terrible fit for a decentralized fund platform of this kind. Creating a Solrise style fund on Ethereum means an initial fee of approximately $500 in gas due to storage costs, alongside an $250+ fee for investor entry and even higher fees for exit. Managers can find themselves paying $150+ every time they rearrange assets.
This just isn’t good enough for our customers. We can’t make our product an universal offering when investors need to be putting in tens of thousands at once to justify the loss to fees, and we can’t provide a competitive environment for our fund managers when they’re paying hundreds of dollars for trades that take half a minute. These fees disincentivize managers from active trading, pushing them towards moving their portfolios around once every few days at most, and restrict investment to those who are able to pay onerous fees.
Luckily — the future is multi chain. Enter Solana.
Solana provides a truly high-performance blockchain architecture that offers currently unparalleled transaction speed and costs. Solana can scale up to 50k transactions per second without an issue (versus Ethereum’s 15) and offers costs that are multiple orders of magnitude lower than the competition. In practice, this means our users can enter or exit funds for an effective cost of around $0.001, and trades are confirmed within moments.
We’ve been building on Solana for the past year — in fact, we previously built both Solflare and Solana Beach — so we know as well as anyone what builders can do on Solana, and we’re very confident about it. We believe that Solana is perfectly adapted to become the third blockchain to hit true widespread adoption after Ether and BTC. BTC has adapted to become a long-term store of value with low trading frequency, whereas Ether has become a natural “clearing house” — an intermediary station for high-value trades and settlement.
Solana provides a crucial alternative offering — that is, a platform naturally adapted for high-frequency activity at low cost, with cross-chain integrations that allow access to key assets from across the crypto universe. Solana’s bidirectional token bridge, Wormhole, is now in the process of active rollout and allows tokenized assets to be transferred directly from Ethereum to Solana — meaning Solana has access to every notable ERC20, alongside the thousands more that nobody cares about.
The Solana ecosystem is growing rapidly, with some very strong integrations available. Serum and its extensive cross-chain functionality will allow us to offer multiple top tokens including BTC, ETH, and USDC at launch. Recent winners of the Solana x Serum DeFi hackathon include Mango Markets, who offer leveraged trading, and Synthetify who are building out a synthetic asset protocol — key aspects of allowing us to offer a “hedge fund-like” set of tools for traders. If we’re able to integrate these services with Solrise, we’ll be able to offer an incredible diversity of assets and strategies to fund managers and investors — and is really just the start of what can be done with Solana.
The key to all this — transaction costs and technology aside — is that using Solana allows us to offer an unprecedented service to our users. With Solrise, anyone can start their own fund with setup and operating costs of close to 0, and anyone with a laptop and $500 can invest and reap the same level of returns that were previously reserved for high net worth individuals. Simply put, building on Solana allows us to offer a drastically better user experience than we could on any other blockchain.
SLRS has been listed on a number of crypto exchanges, unlike other main cryptocurrencies, it cannot be directly purchased with fiats money. However, You can still easily buy this coin by first buying Bitcoin, ETH, USDT, BNB from any large exchanges and then transfer to the exchange that offers to trade this coin, in this guide article we will walk you through in detail the steps to buy SLRS token.
You will have to first buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…
We will use Binance Exchange here as it is one of the largest crypto exchanges that accept fiat deposits.
Binance is a popular cryptocurrency exchange which was started in China but then moved their headquarters to the crypto-friendly Island of Malta in the EU. Binance is popular for its crypto to crypto exchange services. Binance exploded onto the scene in the mania of 2017 and has since gone on to become the top crypto exchange in the world.
Once you finished the KYC process. You will be asked to add a payment method. Here you can either choose to provide a credit/debit card or use a bank transfer, and buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…
Step by Step Guide : What is Binance | How to Create an account on Binance (Updated 2021)
Next step - Transfer your cryptos to an Altcoin Exchange
Since SLRS is an altcoin we need to transfer our coins to an exchange that SLRS can be traded. Below is a list of exchanges that offers to trade SLRS in various market pairs, head to their websites and register for an account.
Once finished you will then need to make a BTC/ETH/USDT/BNB deposit to the exchange from Binance depending on the available market pairs. After the deposit is confirmed you may then purchase SLRS from the exchange: FTX exchange
The top exchange for trading in SLRS token is currently FTX
Find more information SLRS
☞ Website ☞ Social Channel ☞ Social Channel 2 ☞ Social Channel 3 ☞ Message Board ☞ Coinmarketcap
🔺DISCLAIMER: The Information in the post isn’t financial advice, is intended FOR GENERAL INFORMATION PURPOSES ONLY. Trading Cryptocurrency 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)!
☞ **-----https://geekcash.org-----**⭐ ⭐ ⭐
Thank for visiting and reading this article! Please don’t forget to leave a like, comment and share!
#blockchain #bitcoin #slrs #solrise finance
1624219980
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!
1624312800
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
1658068560
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.
["Bayrūt"]
and not ["Bayr", "ū", "t"]
, for example.Add this line to your application's Gemfile:
gem 'words_counted'
And then execute:
$ bundle
Or install it yourself as:
$ gem install words_counted
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.
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
.
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.
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
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.
:odd?
.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}, "و"]
)
# => ["هي", "سامي", "وداني"]
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"]
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")
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.
The program will normalise (downcase) all incoming strings for consistency and filters.
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.
Visit this website for one example of what you can do with WordsCounted.
Contributors
See contributors.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Author: Abitdodgy
Source Code: https://github.com/abitdodgy/words_counted
License: MIT license
1659601560
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.
Visit this website for one example of what you can do with WordsCounted.
["Bayrūt"]
and not ["Bayr", "ū", "t"]
, for example.Add this line to your application's Gemfile:
gem 'words_counted'
And then execute:
$ bundle
Or install it yourself as:
$ gem install words_counted
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.
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
.
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.
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
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.
:odd?
.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}, "و"]
)
# => ["هي", "سامي", "وداني"]
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"]
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")
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.
The program will normalise (downcase) all incoming strings for consistency and filters.
def self.from_url
# open url and send string here after removing html
end
See contributors.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Author: abitdodgy
Source code: https://github.com/abitdodgy/words_counted
License: MIT license
#ruby #ruby-on-rails