Skip to content

Commit 9b973f2

Browse files
committed
Merge branch 'twitter_tokenizer'
2 parents ab9147b + 78aecfc commit 9b973f2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/helpers/helpers.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,13 @@ function ends_with(string $haystack, string $needle) : bool
8282
return \TextAnalysis\Utilities\Text::endsWith($haystack, $needle);
8383
}
8484

85+
/**
86+
* Returns an instance of the TextCorpus
87+
* @param string $text
88+
* @return \TextAnalysis\Corpus\TextCorpus
89+
*/
90+
function text(string $text) : \TextAnalysis\Corpus\TextCorpus
91+
{
92+
return new \TextAnalysis\Corpus\TextCorpus($text);
93+
}
94+

tests/TextAnalysis/Corpus/TextCorpusTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
*/
1313
class TextCorpusTest extends \TestBaseCase
1414
{
15+
public function testInstanceOf()
16+
{
17+
$this->assertInstanceOf(TextCorpus::class, text($this->getText()));
18+
}
19+
1520
public function testConcordance()
1621
{
1722
$corpus = new TextCorpus($this->getText());

0 commit comments

Comments
 (0)