Code Monkey home page Code Monkey logo

mention-hashtag's People

Contributors

lmfresneda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mention-hashtag's Issues

utf-8 support

hi . right now it does n`t support utf-8 characters in text . ( cant tokenize them ) .
for example :

let text = " یک متن #فارسی و یکمم #En برای #تست همه چی !";
let hashtags = mentionHashtag(text,{ symbol: false, type: '#' });
the result is : [ 'یکمتن#فارسیویکمم#ENG' ]

The currect result should be : ['فارسی','تست','Eng']

can you change the regex to support utf-8 texts ?
thanks.

Add TypeScript type definitions

They would be useful for those of us using TS.

Here's the current definition I'm using:

declare module 'mention-hashtag' {
  export enum ExtractionType {
    MENTION = '@',
    HASH_TAG = '#',
    ALL = 'all',
  }
  export type ExtractionOptions = { type: ExtractionType; unique: boolean; symbol: boolean };
  export type ExtractionResult = { mentions: string[]; hashtags: string[] };

  function extract(text: string, options: ExtractionType.ALL): ExtractionResult;
  function extract(
    text: string,
    options: ExtractionOptions | ExtractionType.MENTION | ExtractionType.HASH_TAG,
  ): string[];

  export default extract;
}

I'm not sure if its the best approach, but it does the work. Are you OK with a PR for this?

Combined hashtag support

Is it possible to support combined hashtags, without spaces?

For example: #tag1#tag2#tag3
must return: [tag1 , tag2 , tag3]

Current version returns an empty array for this.

Thanks

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.