echo"deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update &&sudo apt install yarn
```
On Mac OS X with homebrew:
```shell
brew install yarn
```
For other platforms, please refer to [the yarn website](https://www.yarnpkg.com/).
#### Purescript build tools
Once you have yarn installed you can install the necessary purescript build tools:
```shell
yarn global add purescript spago pulp
```
In order to use those tools you might need to add the yarn global package install location to your path. On linux this can be done by adding the following line at the end of your `.bashrc` file:
```shell
export PATH="$(yarn global bin):$PATH"
```
## Development
### Docker environment
Are you using the docker setup? Run this:
```shell
source ./env.sh
```
This enables the docker container to run as the current user so any
files it writes will be readable by you. It also creates a `darn`
shell alias (short for `docker yarn`) for running yarn commands inside
the docker container.
### Basic tasks
Now we must install our javascript and purescript dependencies:
```shell
darn install-D# for docker setup
yarn install-D# for manual setup
```
You will likely want to check your work in a browser. We provide a
local development webserver that serves on port 5000 for this purpose:
```shell
darn server # for docker setup
yarn server # for manual setup
```
To generate a new browser bundle to test:
```shell
darn build # for docker setup
yarn build # for manual setup
```
You may access a purescript repl if you want to explore:
```shell
darn repl # for docker setup
yarn repl # for manual setup
```
If you need to reinstall dependencies such as after a git pull or branch switch:
```shell
darn install-D&& darn install-ps # for docker setup
yarn install-D&& yarn install-ps # for manual setup
```
If something goes wrong building after a deps update, you may clean
build artifacts and try again:
```shell
# for docker setup
darn clean-js # clean javascript, very useful
darn clean-ps # clean purescript, should never be required, possible purescript bug
darn clean # clean both purescript and javascript
# for manual setup
yarn clean-js
yarn clean-ps
yarn clean
```
If you edit the SASS, you'll need to rebuild the CSS:
```shell
darn css # for docker setup
yarn css # for manual setup
```
<!-- A `purs ide` connection will be available on port 9002 while the -->
<!-- development server is running. -->
A guide to getting set up with the IDE integration is coming soon.
### Testing
To run unit tests, just run:
``` shell
test-ps
```
### Note to contributors
Please follow CONTRIBUTING.md
### How do I?
#### Add a javascript dependency?
Add it to `package.json`, under `dependencies` if it is needed at
runtime or `devDependencies` if it is not.
#### Add a purescript dependency?
Add it to `spago.dhall` (or run `spago install ...`).
If is not in the package set, you will need to read the next section.
#### Add a custom or override package to the local package set?
You need to add an entry to the relevant map in
`packages.dhall`. There are comments in the file explaining how it
works. It's written in dhall, so you can use comments and such.
## Theory Introduction
Making sense of out text isn't actually that hard, but it does require
a little background knowledge to understand.
### N-grams
N-grams in contexts (of texts) are at the heart of how Gargantext makes
sense out of text.
There are two common meanings in the literature for n-gram:
- a sequence of `n` characters
- a sequence of `n` words
Gargantext is focused on words. Here are some example word n-grams
usually extracted by our Natural Language Process toolkit;
-`coffee` (unigram or 1-gram)
-`black coffee` (bigram or 2-gram)
-`hot black coffee` (trigram or 3-gram)
-`arabica hot black coffee` (4-gram)
N-grams are matched case insensitively and across whole words removing