#!/usr/local/bin/perl

open (CANTON, "database.tab");
open (PHO, ">pho-list.txt");
$prev = "";
while (<CANTON>) {
	/^([^\t]*)\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t([^\t]*)\n$/;
	$word = $1;
	$pho = $2;
	if ($pho ne $prev) {
		print PHO "\n$pho\t: $word, ";
	} else {
		print PHO "$word, ";
	}
	$prev = $pho;
}
close (CANTON);
close (PHO);
