@@ -0,0 +1,646 @@
+import codecs, re%0A%0Adef search(c, q):%0A  out = %5B%5D%0A  regex = re.compile(q, re.IGNORECASE)%0A  for k in c:%0A    linehits = regex.findall(c%5Bk%5D%5B%22msg%22%5D)%0A    if linehits:%0A      out.append((str(k), c%5Bk%5D%5B%22uname%22%5D, c%5Bk%5D%5B%22msg%22%5D))%0A  return out%0A%0Adef readCorpus():%0A  fin = codecs.open(%22moroccorp.txt%22, %22r%22, %22utf-8%22)%0A  lines = fin.readlines()%0A  fin.close()%0A  crp = %7B%7D%0A  i = 1%0A  for line in lines:%0A    uname = line.split(%22%5Ct%22)%5B0%5D%0A    msg = %22 %22.join(line.split(%22%5Ct%22)%5B1:%5D).strip()%0A    crp%5Bi%5D = %7B%22uname%22: uname, %22msg%22: msg%7D%0A    i += 1%0A  return crp%0A%0Amoroccorp = readCorpus()%0Ahits = search(moroccorp, r%22%5Cbeen %5B%5E%5Cs%5D+e %5Cbmeisje%5Cb%22)%0A%0Afor hit in hits:%0A  print %22%5Ct%22.join(hit)%0A

Create search.py