An open API service indexing awesome lists of open source software.

https://github.com/shubham0204/glove-android

Power of GloVe word embeddings in Android
https://github.com/shubham0204/glove-android

android chaquopy context-understanding glove-embeddings kotlin natural-language-processing word-embeddings

Last synced: 3 months ago
JSON representation

Power of GloVe word embeddings in Android

Awesome Lists containing this project

README

          

# `glove-android`: Using GloVe word embeddings in Android

`glove-android` is an Android library that provides an interface for using popular [GloVe](https://nlp.stanford.edu/projects/glove/)
word embeddings.





## Installation

1. Download `glove-android.aar` from the latest release. (See [Releases](https://github.com/shubham0204/glove-android/releases))
2. Move the AAR to `app/libs`.
3. In module-level `build.gradle`, add the dependency,

```groovy
dependencies {
...
implementation files('libs/glove-android.aar')
...
}
```

## Usage

To load the embeddings from storage, use the `GloVe.loadEmbeddings` method, which returns a `GloveEmbeddings`
object as a parameter in the given lambda function.

```kotlin
val gloveEmbeddings: GloVeEmbeddings

GloVe.loadEmbeddings {
gloveEmbeddings = it
}
```

Call the `gloveEmbeddings.getEmbedding` method providing a word as parameter. The resultant embedding
is returned as a `FloatArray` with `size=50` (indicating a 50-D embedding).

```kotlin
val embedding = gloveEmbeddings.getEmbedding( "hello" )
println( embedding.contentToString() )
```

> If no embedding is found for the given word, an empty `FloatArray` is returned

## Citation

```text
@inproceedings{pennington2014glove,
author = {Jeffrey Pennington and Richard Socher and Christopher D. Manning},
booktitle = {Empirical Methods in Natural Language Processing (EMNLP)},
title = {GloVe: Global Vectors for Word Representation},
year = {2014},
pages = {1532--1543},
url = {http://www.aclweb.org/anthology/D14-1162},
}
```

## Useful Resources

* [Reddit discussion on `r/androiddev`](https://www.reddit.com/r/androiddev/comments/168u3h7/gloveandroid_an_android_library_providing_access/)