{"id":5045,"date":"2016-09-12T01:10:31","date_gmt":"2016-09-12T01:10:31","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5045"},"modified":"2016-09-12T01:10:31","modified_gmt":"2016-09-12T01:10:31","slug":"scoring-documents-quality-python-often-speaker-say-um","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/scoring-documents-quality-python-often-speaker-say-um\/","title":{"rendered":"Scoring documents for quality in Python &#8211; how often does a speaker say &#8220;um&#8221;?"},"content":{"rendered":"<p>As part of a <a href=\"https:\/\/www.findlectures.com\/\">project<\/a>, I thought it might be interesting to score lectures for how often the speaker says &#8220;um&#8221; (or similar). <\/p>\n<p>An interesting realization here is that an automated transcription of a lecture is superior for this purpose than manual closed captions or a written transcript, as those edit the material down.<\/p>\n<p>You need to tokenize whatever text you have:<\/p>\n<pre lang=\"python\">\nfrom nltk import word_tokenize\ntokens = word_tokenize(transcript)\n<\/pre>\n<p>Realistically, you only care if this is a frequent occurrence, so the best way to use this is combined with a threshold, or to feed this into a polynomial function that reduces the quality score for a transcript as it gets more severe.<\/p>\n<pre lang=\"python\">\ncheck = [\"um\", \"uh\", \"ah\", \"ehm\", \"eh\", \"uhm\", \"ah\", \"umm\", \"er\"]\n  \ndef umsScore(tokens):\n  bad = 0\n  for t in tokens:\n    if (t.lower() in check):\n      cnt = cnt + 1\n\n  return cnt\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Scoring talk transcripts for quality of word use in python<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[12],"tags":[447],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5045"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=5045"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5045\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}