{"id":20041261,"url":"https://github.com/gernest/mention","last_synced_at":"2025-06-27T20:36:51.775Z","repository":{"id":44172586,"uuid":"44137538","full_name":"gernest/mention","owner":"gernest","description":"Twitter like mentions  and #hashtags parser for Go(Golang)","archived":false,"fork":false,"pushed_at":"2020-03-20T22:48:19.000Z","size":17,"stargazers_count":108,"open_issues_count":3,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-07T07:07:27.372Z","etag":null,"topics":["hashtag","parser","twitter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gernest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-12T22:25:16.000Z","updated_at":"2025-03-20T19:39:12.000Z","dependencies_parsed_at":"2022-09-26T17:41:23.445Z","dependency_job_id":null,"html_url":"https://github.com/gernest/mention","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/gernest/mention","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gernest%2Fmention","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gernest%2Fmention/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gernest%2Fmention/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gernest%2Fmention/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gernest","download_url":"https://codeload.github.com/gernest/mention/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gernest%2Fmention/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262329686,"owners_count":23294741,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hashtag","parser","twitter"],"created_at":"2024-11-13T10:46:00.896Z","updated_at":"2025-06-27T20:36:51.741Z","avatar_url":"https://github.com/gernest.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mention [![Build Status](https://travis-ci.org/gernest/mention.svg)](https://travis-ci.org/gernest/mention) [![Coverage Status](https://coveralls.io/repos/gernest/mention/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/gernest/mention?branch=master) [![GoDoc](https://godoc.org/github.com/gernest/mention?status.svg)](https://godoc.org/github.com/gernest/mention)\n\n`mention` parses twitter like mentions and hashtags like @gernest and #Tanzania from text input.\n\n# Installation\n\n\tgo get github.com/gernest/mention\n\t\n\n# Usage\n\n`mention` is flexible, meaning it is not only limited to `@` and `#` tags. You can choose whatever tag you like and mention will take it from there.\n\n## twitter like mentions\n\nFor instance you have the following message\n\n```\nhello @gernesti I would like to follow you on twitter\n```\n\nAnd you want to know who was mentioned in the text.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/gernest/mention\"\n)\n\nfunc main() {\n\tmessage := \"hello @gernest I would like to follow you on twitter\"\n\n\ttags := mention.GetTags('@', message)\n\ttagStrings := mention.GetTagsAsUniqueStrings('@', message)\n\n\tfmt.Println(tags)\n\tfmt.Println(tagStrings)\n}\n```\n\nIf you run the above example it will print `[gernest]` is the stdout.\n\n## twitter like hashtags\n\nFor instance you have the following message\n\n```\nhow does it feel to be rejected? #loner\n```\n\nAnd you want to know the hashtags\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/gernest/mention\"\n)\n\nfunc main() {\n\tmessage := \"how does it feel to be rejected? #loner\"\n\n\ttags := mention.GetTags('#', message)\n\n\tfmt.Println(tags)\n}\n```\n\nIf you run the above example it will print `[loner]` in the stdout.\n\n# The API\nmention exposes only one function `GetTags(char rune, src string) []string`\n\nThe first argument `char` is the prefix for your tag, this can be `@` or `#` or whatever unicode character you prefer. Don't be worried by its type `rune` it is just your normal characters but in single quotes. See the examples for more information.\n\nThe second argument is the source of the input which can be from texts.\n\n# Contributing\n\nStart with clicking the star button to make the author and his neighbors happy. Then fork the repository and submit a pull request for whatever change you want to be added to this project.\n\nIf you have any questions, just open an issue.\n\n# Author\nGeofrey Ernest\nTwitter  : [@gernesti](https://twitter.com/gernesti)\n\nChad Barraford\nGithub  : [@cbarraford](https://github.com/cbarraford)\n\n\n# Licence\n\nThis project is released under the MIT licence. See [LICENCE](LICENCE) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgernest%2Fmention","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgernest%2Fmention","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgernest%2Fmention/lists"}