Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j3k0/ledger-guesser
Machine Learning for ledger-cli
https://github.com/j3k0/ledger-guesser
Last synced: 22 days ago
JSON representation
Machine Learning for ledger-cli
- Host: GitHub
- URL: https://github.com/j3k0/ledger-guesser
- Owner: j3k0
- Created: 2019-05-27T10:47:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-08-09T15:11:43.000Z (about 2 years ago)
- Last Synced: 2024-04-08T00:24:14.045Z (7 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 35
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ledger Guesser
> Harness the power of machine learning with ledger-cli
_experimental_ but functional.
## Install
```
git clone https://github.com/j3k0/ledger-guesser.git
cd ledger-guesser
npm install
```## Usage
### Training
```
./ledger-guesser --train JOURNAL_FILE.txt
```Will take quite some time (depending on the size of your journal). This will
generate files `~/.ledger-guesser-nn-[0-9a-f].json`.### Guessing
Once the neural network has been trained, you can make it guess the full ledger
entry.```
./ledger-guesser PAYEE AMOUNT CURRENCY [DATE]
```**Example**
```
$ ./ledger-guesser 'GOOGLE GSUITE_ USD10.00' -10.00 USD 2019/05/212019/05/21 GOOGLE GSUITE_ USD10.00
Assets:Bank:Blom:Usd -10.00 USD
Expenses:Tools:Gsuite 10.00 USD```
Note that you can change the directory where `ledger-guesser` stores training
files by setting the `TRAINING_DIR` environment variable.Example: `export TRAINING_DIR=~/company-2`
### Lower-level usage
The `./ledger-guesser` script make use of `index.js` to create 16 different
files: 1 for each potential line in the ledger entry.`node index.js" --train journal_file.txt --index=0` will output training output
in JSON for the first line of the a ledger entry. (index=1 for the second line,
etc).`node index.js --guess training.json PAYEE AMOUNT CURRENCY` will output a line
of ledger entry.**Example**
```
$ node index.js --train journal.txt --index=0 > line-0.json
$ node index.js --train journal.txt --index=1 > line-1.json
$ node index.js --guess line-0.json 'GOOGLE GSUITE_ USD10.00' -10.00 USD
Assets:Bank:Blom:Usd -10.00 USD
$ node index.js --guess line-1.json 'GOOGLE GSUITE_ USD10.00' -10.00 USD
Expenses:Tools:Gsuite 10.00 USD
```## With ledger-autosync
For my usage, I use a forked version of `ledger-autosync` that uses
`ledger-guesser` for guessing account names. This allows to import full CSV/OFX
files and create a pretty accurate output.https://github.com/j3k0/ledger-autosync/tree/fovea
The interesting commit is here: https://github.com/j3k0/ledger-autosync/commit/24de64d2d711199b7e0898325aceeedeb09bb596#diff-235eadfde015c04f77e02a6063e19c2cR199
A proper integration is left as an exercice to the user! ;-)
## Contributing
PRs accepted.
## License
MIT © Jean-Christophe Hoelt