Git Product home page Git Product logo

brenoepics / mentionextractor Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 1.0 42 KB

MentionExtractor is a Kotlin library designed to parse text and extract mentions following customizable patterns. It offers flexibility in configuring the pattern. Whether you're building a chatbot, social media analytics tool, or content moderation system.

License: Apache License 2.0

Kotlin 100.00%
mention-detection mention-extraction

mentionextractor's Introduction

MentionExtractor

Maven Central Coverage Quality Gate Status

A Kotlin library for extracting mentions from a text based on specified patterns. It provides flexible configuration options for handling mentions in a text.

Usage

Arcturus Morningstar

Plugin Download

Custom

To use the MentionExtractor library:

  1. Create a MentionPattern instance and configure it according to your requirements.

  2. Use the MentionExtractor.Builder to construct an instance of MentionExtractor, providing the configured MentionPattern and any additional settings such as the maximum number of mentions to handle.

  3. Use the methods provided by MentionExtractor to extract mentions from text, check if a text contains a mention, or count the number of mentions in a text.

Here's an example of how to use MentionExtractor:

// Configure MentionPattern
val mentionPattern = MentionPattern().withSpecialChars()

// Create MentionExtractor instance
val extractor = MentionExtractor.Builder()
    .pattern(mentionPattern)
    .maxMentions(5)
    .build()

// Extract mentions from text
val text = "Hey @user1, did you see @user2's message?"
val mentions = extractor.fromString(text)

// Check if text contains a mention
val containsMention = extractor.containsMention(text)

// Count the number of mentions in text
val mentionCount = extractor.countMentions(text)

Download / Installation

The recommended way to get MentionExtractor is to use a build manager, like Gradle or Maven.

Maven-central Dependency

Gradle
implementation group: 'io.github.brenoepics', name: 'MentionExtractor', version: '1.0.0'
Maven
<dependency>
    <groupId>io.github.brenoepics</groupId>
    <artifactId>MentionExtractor</artifactId>
    <version>1.0.0</version>
</dependency>
Sbt
libraryDependencies += "io.github.brenoepics" % "MentionExtractor" % "1.0.0"

Testing

We use JUnit 5 for testing the MentionExtractor. To run the tests:

  1. Ensure you have Maven installed on your system.

  2. Navigate to the root directory of the project containing the pom.xml file.

  3. Run the following Maven command:

    mvn test

This will execute the JUnit tests defined in the test package and provide the test results.

License

This project is licensed under the Apache 2.0 License—see the LICENSE file for details.

mentionextractor's People

Contributors

brenoepics avatar

Stargazers

 avatar  avatar  avatar Yan avatar Jonathan Santos avatar  avatar Say Seven avatar joaowars776 avatar The Windows Slayer  avatar luiz phellipe avatar

Watchers

 avatar  avatar

Forkers

danielsenorjan

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.