Exemplo n.º 1
0
 def build(self):
     lang = App.get_running_app().lang
     if (lang == 'zh'):
         self.ids.label2.font_name = "simkai.ttf"
     elif (lang == "ja"):
         self.ids.label2.font_name = "irohamaru-mikami-Regular.ttf"
     s = "Missed words: " + ", ".join(App.get_running_app().missed_keys)
     self.ids.label2.text = str(s)
     values = mysptotal("user_input",
                        "sbuhacks-2/myprosody-master/myprosody")
     labels = [
         "Number of syllables: ", "Number of pauses: ",
         "Average rate of speech: ", "Articulation rate: ",
         "Speaking duration: ", "Original duration: ", "Average balance: ",
         "Average Frequency: "
     ]
     s = ""
     for x in range(len(labels)):
         s += labels[x] + values[0][x] + "\n"
     self.ids.label1.text = str(s)
     averages = [13, 1, 0.65, 2, 17, 30, 0.55]
     num = random.randint(0, len(averages) - 1)
     if float(values[0][num]) > averages[num]:
         self.ids.label3.text = str("Your " + labels[num][:-2].lower() +
                                    " is higher than the average of " +
                                    str(averages[num]) + ".")
     else:
         self.ids.label3.text = str("Your " + labels[num][:-2].lower() +
                                    " is lower than the average of " +
                                    str(averages[num]) + ".")
Exemplo n.º 2
0
import myprosody as mysp
import pickle

#p="embarrasing moment wt"
p = "embarrasing moment example"
c = r"/Users/wtoledo/Documents/wt/toefl/myprosody/myprosody"

mysp.mysptotal(p, c)
mysp.myspgend(p, c)
mysp.myspsyl(p, c)
mysp.mysppaus(p, c)
mysp.myspsr(p, c)
mysp.myspatc(p, c)
mysp.myspst(p, c)
mysp.myspod(p, c)
mysp.myspbala(p, c)
mysp.myspf0mean(p, c)
mysp.myspf0sd(p, c)
mysp.myspf0med(p, c)
mysp.myspf0min(p, c)
mysp.myspf0max(p, c)
mysp.myspf0q25(p, c)
mysp.myspf0q75(p, c)
mysp.mysppron(p, c)
mysp.myprosody(p, c)
mysp.mysplev(p, c)
Exemplo n.º 3
0
import sys
sys.path.insert(1, "sbuhacks-2/myprosody-master")
from myprosody import mysptotal
import testpro
print(mysptotal("user_input", "sbuhacks-2/myprosody-master/myprosody"))
Exemplo n.º 4
0
def verification():
    logging.info("audio verification")
    logging.info("params")
    req = request.form
    uploaded_file = request.files['audio_file']
    audio_file = uploaded_file
    file = audio_file
    file_ext = os.path.splitext(file.filename)[1]

    logging.info(f"filename {file.filename} ")

    logging.info(f"file ext {file_ext}")

    if file and allowed_file(file.filename):
        filename = secure_filename(file.filename)
        file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))

    p = file.filename.partition('.')[0]
    c = app.config['AUDIO_FILES']

    sound = app.config['UPLOAD_FOLDER'] + "/" + secure_filename(file.filename)

    r = sr.Recognizer()
    audio_file = sr.AudioFile(sound)
    with audio_file as source:
        audio = r.record(source)

    audio_to_text = r.recognize_google(audio)

    # get the matches
    audio_text_matches = tool.check(audio_to_text)
    logging.info("audio_text_matches")
    logging.info(audio_text_matches)

    logging.info(f"audio to text: {audio_to_text}")
    logging.info(f"sound to check {sound}")
    t = Timer()
    t.start()
    logging.info("overview")
    overview = mysp.mysptotal(p, c, sound)
    logging.info(overview)
    t.stop()

    # logging.info("gender")
    # t.start()
    # gender = mysp.myspgend(p, c,sound)
    # logging.info(gender)
    # t.stop()

    # logging.info("syllabe")
    # t.start()
    # syllabe = mysp.myspsyl(p, c,sound)
    # logging.info(syllabe)
    # t.stop()

    # logging.info("filters and pauses")
    # t.start()
    # pause = mysp.mysppaus(p, c,sound)
    # logging.info(pause)
    # t.stop()

    # logging.info("rate of the speech")
    # t.start()
    # speech_rate = mysp.myspsr(p, c,sound)
    # logging.info(speech_rate)
    # t.stop()

    # logging.info("articulation speed")
    # t.start()
    # articulation_speed = mysp.myspatc(p, c,sound)
    # logging.info(articulation_speed)
    # t.stop()

    # logging.info("speaking time")
    # t.start()
    # speaking_time = mysp.myspst(p, c,sound)
    # logging.info(speaking_time)
    # t.stop()

    # logging.info("speaking duration")
    # t.start()
    # total_speaking_duration = mysp.myspod(p, c,sound)
    # logging.info(total_speaking_duration)
    # t.stop()

    # logging.info("balance")
    # t.start()
    # balance = mysp.myspbala(p, c,sound)
    # logging.info(balance)
    # t.stop()

    # logging.info("freq_dist_mean")
    # t.start()
    # freq_dist_mean = mysp.myspf0mean(p, c,sound)
    # logging.info(freq_dist_mean)
    # t.stop()

    # logging.info("freq_dist_sd")
    # t.start()
    # freq_dist_sd = mysp.myspf0sd(p, c,sound)
    # logging.info(freq_dist_sd)
    # t.stop()

    # logging.info("freq_dist_median")
    # t.start()
    # freq_dist_median = mysp.myspf0med(p, c,sound)
    # logging.info(freq_dist_median)
    # t.stop()

    # logging.info("freq_dist_minimun")
    # t.start()
    # freq_dist_minimun = mysp.myspf0min(p, c,sound)
    # logging.info(freq_dist_minimun)
    # t.stop()

    # logging.info("freq_dist_max")
    # t.start()
    # freq_dist_max = mysp.myspf0max(p, c,sound)
    # logging.info(freq_dist_max)
    # t.stop()

    # logging.info("quantile_25th")
    # t.start()
    # quantile_25th = mysp.myspf0q25(p, c,sound)
    # logging.info(quantile_25th)
    # t.stop()

    # logging.info("quantile_75th")
    # t.start()
    # quantile_75th = mysp.myspf0q75(p, c,sound)
    # logging.info(quantile_75th)
    # t.stop()

    logging.info("pronuntiation_probability_score")
    t.start()
    pronuntiation_probability_score = mysp.mysppron(p, c, sound)
    logging.info(pronuntiation_probability_score)
    t.stop()

    logging.info("native_comparation")
    t.start()
    native_comparation = mysp.myprosody(p, c, sound)
    logging.info(native_comparation)
    t.stop()

    # logging.info("spoken_lang_proeficiency_level")
    # t.start()
    # spoken_lang_proeficiency_level = mysp.mysplev(p, c,sound)
    # logging.info(spoken_lang_proeficiency_level)
    # t.stop()
    data = {}
    data = jsonify({
        "overview": str(overview),
        "audio_to_text": audio_to_text,
        # "audio_text_matches":audio_text_matches,
        #  "gender": gender,
        #  "syllabe": syllabe,
        #  "pause": pause,
        #  "speech_rate": speech_rate,
        #  "articulation_speed": articulation_speed,
        #  "speaking_time": speaking_time,
        #  "total_speaking_duration": total_speaking_duration,
        #  "balance": balance,
        #  "freq_dist_mean": freq_dist_mean,
        #  "freq_dist_sd": freq_dist_sd,
        #  "freq_dist_median": freq_dist_median,
        #  "freq_dist_minimum": freq_dist_minimun,
        #  "freq_dist_max": freq_dist_max,
        #  "quantile_25th": quantile_25th,
        #  "quantile_75th": quantile_75th,
        "pronuntiation_probability_score": pronuntiation_probability_score,
        "native_comparation": native_comparation
    })

    logging.info(f"data  {data}")
    response = make_response(
        data,
        401,
    )
    response.headers["Content-Type"] = "application/json"
    return response
Exemplo n.º 5
0
def test(p, c):
    return mysp.mysptotal(p, c)