Skip to content

Commit

Permalink
a commit that I should have done first
Browse files Browse the repository at this point in the history
  • Loading branch information
chrobione committed Aug 2, 2016
1 parent 772a44e commit 2956f4f
Show file tree
Hide file tree
Showing 183 changed files with 9,584 additions and 0 deletions.
23 changes: 23 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Jasper was originally created by Shubhro Saha and Charles Marsh in early 2014.
In August 2014, the core development team has been joined by Jan Holthuis.

Jan Holthuis <[email protected]>
Charles Marsh <[email protected]>
Shubhro Saha <[email protected]>

Here is a probably incomplete list of contributors, that helped to improve
Jasper. Thanks a lot!

Alex Bate <[email protected]>
Andy Buckingham <[email protected]>
David Celis <[email protected]>
Cedric Claidiere
dag0310
Alex Siri
Andrew Stahlman <[email protected]>
James Timmons

*Please alphabetize new entries*

We'd also like to thank all the people who reported bugs, helped
answer newbie questions, and generally made Jasper better.
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to Jasper

Want to contribute to Jasper? Great! We're always happy to have more contributors. Before you start developing, though, we ask that you read through this document in-full. It's full of tips and guidelines--if you skip it, you'll likely miss something important (and your pull request will probably be rejected as a result).

Throughout the process of contributing, there's one thing we'd like you to remember: Jasper was developed (and is maintained) by what might be described as "volunteers". They earn no money for their work on Jasper and give their time solely for the advancement of the software and the enjoyment of its users. While they will do their best to get back to you regarding issues and pull requests, **your patience is appreciated**.

## Reporting Bugs

The [bug tracker](https://github.com/jasperproject/jasper-client/issues) at Github is for reporting bugs in Jasper. If encounter problems during installation or compliation of one of Jasper's dependencies for example, do not create a new issue here. Please open a new thread in the [support forum](https://groups.google.com/forum/#!forum/jasper-support-forum) instead. Also, make sure that it's not a usage issue.

If you think that you found a bug and that you're using the most recent version of Jasper, please include a detailed description what you did and how to reproduce the bug. If Jasper crashes, run it with `--debug` as command line argument and also include the full stacktrace (not just the last line). If you post output, put it into a [fenced code block](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks). Last but not least: have a look at [Simon Tatham's "How to Report Bugs Effectively"](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) to learn how to write a good bug report.

## Opening Pull Requests

### Philosophies

There are a few key philosophies to preserve while designing features for Jasper:

1. **The core Jasper software (`jasper-client`) must remain decoupled from any third-party web services.** For example, the Jasper core should never depend on Google Translate in any way. This is to avoid unnecessary dependences on web services that might change or become paid over time.
2. **The core Jasper software (`jasper-client`) must remain decoupled from any paid software or services.** Of course, you're free to use whatever you'd like when running Jasper locally or in a fork, but the main branch needs to remain free and open-source.
3. **Jasper should be _usable_ by both beginner and expert programmers.** If you make a radical change, in particular one that requires some sort of setup, try to offer an easy-to-run alternative or tutorial. See, for example, the profile populator ([`jasper-client/client/populate.py`](https://github.com/jasperproject/jasper-client/blob/master/client/populate.py)), which abstracts away the difficulty of correctly formatting and populating the user profile.

### DOs and DON'Ts

While developing, you **_should_**:


1. **Ensure that the existing unit tests pass.** They can be run via `python2 -m unittest discover` for Jasper's main folder.
2. **Test _every commit_ on a Raspberry Pi**. Testing locally (i.e., on OS X or Windows or whatnot) is insufficient, as you'll often run into semi-unpredictable issues when you port over to the Pi. You should both run the unit tests described above and do some anecdotal testing (i.e., run Jasper, trigger at least one module).
3. **Ensure that your code conforms to [PEP8](http://legacy.python.org/dev/peps/pep-0008/) and our existing code standards.** For example, we used camel case in a few places (this could be changed--send in a pull request!). In general, however, defer to PEP8. We also really like Jeff Knupp's [_Writing Idiomatic Python_](http://www.jeffknupp.com/writing-idiomatic-python-ebook/). We use `flake8` to check this, so run it from Jasper's main folder before committing.
4. Related to the above: **Include docstrings that follow our existing format!** Good documentation is a good thing.
4. **Add any new Python dependencies to requirements.txt.** Make sure that your additional dependencies are dependencies of `jasper-client` and not existing packages on your disk image!
5. **Explain _why_ your change is necessary.** What does it accomplish? Is this something that others will want as well?
6. Once your pull request has received some positive feedback: **Submit a parallel pull request to the [documentation repository](https://github.com/jasperproject/jasperproject.github.io)** to keep the docs in sync.

On the other hand, you **_should not_**:

1. **Commit _any_ modules to the _jasper-client_ repository.** The modules included in _jasper-client_ are meant as illustrative examples. Any new modules that you'd like to share should be done so through other means. If you'd like us to [list your module](http://jasperproject.github.io/documentation/modules/) on the web site, [submit a pull request here](https://github.com/jasperproject/jasperproject.github.io/blob/master/documentation/modules/index.md).
2. **_Not_ do any of the DOs!**

### TODOs

If you're looking for something to do, here are some suggestions:

1. Improve unit-testing for `jasper-client`. The Jasper modules and `brain.py` have ample testing, but other Python modules (`conversation.py`, `mic.py`, etc.) do not.
2. Come up with a better way to automate testing on the Pi. This might include spinning up some sort of VM with [Docker](http://docs.docker.io), or take a completely different approach.
3. Buff up the text-refinement functions in [`alteration.py`](https://github.com/jasperproject/jasper-client/blob/master/client/alteration.py). These are meant to convert text to a form that will sound more human-friendly when spoken by your TTS software, but are quite minimal at the moment.
4. Make Jasper more platform-independent. Currently, Jasper is only supported on Raspberry Pi and OS X.
5. Decouple Jasper from any specific Linux audio driver implementation.
5 changes: 5 additions & 0 deletions Jasper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import jasper

jasper.main()
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

*Copyright (c) 2014-2015 Charles Marsh, Shubhro Saha & Jan Holthuis*

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
J2
=============

So this is the J2 fork of thejasperproject, thank you for all the work to this point and hope to merge back up with yall.

Client code for the Jasper voice computing platform. Jasper is an open source platform for developing always-on, voice-controlled applications.


This fork is a work in progress and as such if you find something missing/broke/anything please make a pull request with tests would be nice, or file an issue.

There are plenty of things that need help. If you have to ask your not looking at the code.

Documentation is the first thing.


If you have a jasper working install then you should only need to do the following:

`sudo pip install slugify mad`

and for msgfmt - install do `sudo apt install gettext`

There are more instructions coming for how to get multi-language going.



Here is a sample of the ~/.jasper/profile.yml
```
#J2 and jasper-dev branch profile.yml full example.
# Celluar Carrier http://www.emailtextmessages.com for more info exampl is Verizon.
carrier: vtext.com
# First name how the computer will address you
first_name: Yourname
# Last or Surname
last_name: Yourlastname
# Warning GMAIL CONFIG IS UNSECURE PLAIN TEXT STORED PASSWORD
gmail_address: [email protected]
gmail_password: xxxxxxxx
# This for weather forecast can acces City or zipcode
weather:
location: 'POSTALCODE'
# Phone number you can receive text messages on.
phone_number: 'xxxxxxxxxxx'
# This sends alerts. false = text message. true = email message.
prefers_email: false
# Time zone so when you ask for the time it tells you correctly
timezone: America/Denver
# Passive engine configuration (keyword detection)
#stt_passive_engine: x
# Speech To Text engine with witai-stt example
stt_engine: witai-stt
witai-stt:
access_token: X
# Text To Speech Config default is espeak-tts
# uncomment to use
#tts_engine: mary-tts
#mary-tts:
# server: 'tts.mattcurry.com'
# port: '59125'
# language: 'en_US'
# voice: 'cmu-slt-hsmm'
# Audio configuration
# uncomment to use
#audio_engine: pyaudio
#Mic configuration
#input_device:
#Speak out configuration
#output_device:
# Wolfram Alpha Integration
#keys:
#WOLFRAMALPHA: X
```
12 changes: 12 additions & 0 deletions compile_translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Helper script to compile all "*.po" files to "*.mo" files
ROOT_DIR="$(dirname "$0")"

echo "Search directory: '${ROOT_DIR}'"
find "${ROOT_DIR}" -type f -iname "*.po" -print0 | while IFS= read -r -d $'\0' PO_FILE;
do
echo "Compiling: '${PO_FILE}'"
MO_FILE="${PO_FILE:0:-3}.mo"
msgfmt -o "${MO_FILE}" "${PO_FILE}"
done
echo "Done."
4 changes: 4 additions & 0 deletions jasper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from .__main__ import main

__all__ = ['main']
59 changes: 59 additions & 0 deletions jasper/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
import sys
import logging
import argparse

from . import application
from application import USE_STANDARD_MIC, USE_TEXT_MIC, USE_BATCH_MIC


def main(args=None):
parser = argparse.ArgumentParser(description='Jasper Voice Control Center')
parser.add_argument('--debug', action='store_true',
help='Show debug messages')
list_info = parser.add_mutually_exclusive_group(required=False)
list_info.add_argument('--list-plugins', action='store_true',
help='List plugins and exit')
list_info.add_argument('--list-audio-devices', action='store_true',
help='List audio devices and exit')
mic_mode = parser.add_mutually_exclusive_group(required=False)
mic_mode.add_argument('--local', action='store_true',
help='Use text input instead of a real microphone')
mic_mode.add_argument('--batch', dest='batch_file', metavar="FILE",
type=argparse.FileType('r'),
help='Batch mode using a text file with text' +
'commands audio filenames at each line.')
p_args = parser.parse_args(args)

print("*******************************************************")
print("* JASPER - THE TALKING JASPER *")
print("* (c) 2015 Shubhro Saha, Charlie Marsh & Jan Holthuis *")
print("*******************************************************")

# Set up logging
logging.basicConfig(level=logging.DEBUG if p_args.debug else logging.INFO)

# Select Mic
if p_args.local:
# Use Local text mic
used_mic = USE_TEXT_MIC
elif p_args.batch_file is not None:
# Use batched mode mic, pass a file too
used_mic = USE_BATCH_MIC
else:
used_mic = USE_STANDARD_MIC

# Run Jasper
app = application.Jasper(use_mic=used_mic,
batch_file=p_args.batch_file)
if p_args.list_plugins:
app.list_plugins()
sys.exit(1)
elif p_args.list_audio_devices:
app.list_audio_devices()
sys.exit(0)
app.run()


if __name__ == '__main__':
main()
21 changes: 21 additions & 0 deletions jasper/alteration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
import re


def detect_years(input):
YEAR_REGEX = re.compile(r'(\b)(\d\d)([1-9]\d)(\b)')
return YEAR_REGEX.sub('\g<1>\g<2> \g<3>\g<4>', input)


def clean(input):
"""
Manually adjust output text before it's translated into
actual speech by the TTS system. This is to fix minior
idiomatic issues, for example, that 1901 is pronounced
"one thousand, ninehundred and one" rather than
"nineteen oh one".
Arguments:
input -- original speech text to-be modified
"""
return detect_years(input)
Loading

0 comments on commit 2956f4f

Please sign in to comment.