# Word-based tokenizers

**URL:** <https://discuss.huggingface.co/t/word-based-tokenizers/33992>\
**Category:** Beginners\
**Created:** [March 17, 2023, 6:10am UTC](https://discuss.huggingface.co/t/word-based-tokenizers/33992 "2023-03-17T06:10:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrian-123](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@adrian-123](https://discuss.huggingface.co/u/adrian-123)\
**Post date:** [March 17, 2023, 6:10am UTC](https://discuss.huggingface.co/t/word-based-tokenizers/33992/1 "2023-03-17T06:10:10Z")

</div>

Does hugging face has any word tokenizer? I’m looking for one that can separate the english words in a string without spaces nor punctuation.  
thanks

---

<div class="post-metadata">

**Author:** ![dblakely](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dblakely](https://discuss.huggingface.co/u/dblakely)\
**Post date:** [March 17, 2023, 5:11pm UTC](https://discuss.huggingface.co/t/word-based-tokenizers/33992/2 "2023-03-17T17:11:50Z")

</div>

Hi, to my knowledge Huggingface doesn’t have a tokenizer like that but you could do this using `nltk`. For example:

```python
from nltk.tokenize import word_tokenize
import string

input = "This is a sentence. This is another sentence."

tokens = word_tokenize(input)

# = ['This', 'is', 'a', 'sentence', '.', 'This', 'is', 'another', 'sentence', '.']

# Filter out the punctuation
tokens = [token for token in tokens if token not in string.punctuation]

# = ['This', 'is', 'a', 'sentence', 'This', 'is', 'another', 'sentence']

```
