-- Generation Time: Oct 17, 2007
-- Last update: Oct 17, 2007
-- Database: `flib`
--
-- BY JULIO RAFFO (EPFL/CEMI)
--
-- --------------------------------------------------------


DELIMITER $$

DROP FUNCTION IF EXISTS flib.lvlegalformc $$
CREATE FUNCTION flib.lvlegalformc(dirtystring VARCHAR(500)) RETURNS varchar(500) CHARSET utf8
BEGIN

	DECLARE tempstring varchar(500);

set tempstring=concat(' ', dirtystring,' ');

set tempstring=replace(tempstring,' mfg company inc ',' manufacturing company ');
set tempstring=replace(tempstring,' mfg co inc ',' manufacturing company ');
set tempstring=replace(tempstring,' co inc ',' company ');
set tempstring=replace(tempstring,' mfg inc ',' manufacturing ');
set tempstring=replace(tempstring,' ltd inc ','  ');
set tempstring=replace(tempstring,' intl inc ',' international ');
set tempstring=replace(tempstring,' int l inc ',' international ');
set tempstring=replace(tempstring,' corp inc ',' corporation ');
set tempstring=replace(tempstring,' inc ','  ');
set tempstring=replace(tempstring,' in c ','  ');
set tempstring=replace(tempstring,' mfg co ltd ',' manufacturing company ');
set tempstring=replace(tempstring,' m f g co ltd ',' manufacturing company ');
set tempstring=replace(tempstring,' int co ltd ',' international company ');
set tempstring=replace(tempstring,' int l co ltd ',' international company ');
set tempstring=replace(tempstring,' co co ltd ',' company ');
set tempstring=replace(tempstring,' co ltd ',' company ');
set tempstring=replace(tempstring,' co lt d ',' company ');
set tempstring=replace(tempstring,' co l t d ',' company ');
set tempstring=replace(tempstring,' co pty ltd ',' company ');
set tempstring=replace(tempstring,' int l pty ltd ',' (international) ');
set tempstring=replace(tempstring,' intl pty ltd ',' (international) ');
set tempstring=replace(tempstring,' mfg pty ltd ',' manufacturing ');
set tempstring=replace(tempstring,' qld pty ltd ','  ');
set tempstring=replace(tempstring,' vic pty ltd ','  ');
set tempstring=replace(tempstring,' s a pty ltd ','  ');
set tempstring=replace(tempstring,' sa pty ltd ','  ');
set tempstring=replace(tempstring,' pty ltd ','  ');
set tempstring=replace(tempstring,' co pte ltd ',' company ');
set tempstring=replace(tempstring,' s pte ltd ','  ');
set tempstring=replace(tempstring,' pte ltd ','  ');
set tempstring=replace(tempstring,' corp ltd ',' corporation ');
set tempstring=replace(tempstring,' mfg ltd ',' manufacturing ');
set tempstring=replace(tempstring,' co inc ltd ',' company ');
set tempstring=replace(tempstring,' inc ltd ','  ');
set tempstring=replace(tempstring,' int l ltd ',' international ');
set tempstring=replace(tempstring,' intl ltd ',' international ');
set tempstring=replace(tempstring,' int ltd ',' international ');
set tempstring=replace(tempstring,' kabushiki kaisha ltd ','  ');
set tempstring=replace(tempstring,' ltd ','  ');
set tempstring=replace(tempstring,' l t d ','  ');
set tempstring=replace(tempstring,' c s p a ',' company ');
set tempstring=replace(tempstring,' c spa ',' company ');
set tempstring=replace(tempstring,' co s p a ',' company ');
set tempstring=replace(tempstring,' co spa ',' company ');
set tempstring=replace(tempstring,' s p a ','  ');
set tempstring=replace(tempstring,' spa ','  ');
set tempstring=replace(tempstring,' s pa ','  ');
set tempstring=replace(tempstring,' sp a ','  ');
set tempstring=replace(tempstring,' c s r l ',' company ');
set tempstring=replace(tempstring,' c srl ',' company ');
set tempstring=replace(tempstring,' e c s r l ',' company ');
set tempstring=replace(tempstring,' co s r l ',' company ');
set tempstring=replace(tempstring,' ltd srl ','  ');
set tempstring=replace(tempstring,' l t d s r l ','  ');
set tempstring=replace(tempstring,' s r l ','  ');
set tempstring=replace(tempstring,' srl ','  ');
set tempstring=replace(tempstring,' s rl ','  ');
set tempstring=replace(tempstring,' sr l ','  ');
set tempstring=replace(tempstring,' s ss r l ',' s.ß.r.l ');
set tempstring=replace(tempstring,' co pty limited ',' company ');
set tempstring=replace(tempstring,' pty limited ','  ');
set tempstring=replace(tempstring,' co limited ',' company ');
set tempstring=replace(tempstring,' co nz limited ',' company ');
set tempstring=replace(tempstring,' nz limited ','  ');
set tempstring=replace(tempstring,' n z limited ','  ');
set tempstring=replace(tempstring,' h k limited ','  ');
set tempstring=replace(tempstring,' hk limited ','  ');
set tempstring=replace(tempstring,' ip limited ','  ');
set tempstring=replace(tempstring,' i p limited ','  ');
set tempstring=replace(tempstring,' pte limited ','  ');
set tempstring=replace(tempstring,' bvi limited ','  ');
set tempstring=replace(tempstring,' b v i limited ','  ');
set tempstring=replace(tempstring,' bvio limited ','  ');
set tempstring=replace(tempstring,' n i limited ','  ');
set tempstring=replace(tempstring,' ni limited ','  ');
set tempstring=replace(tempstring,' limited ','  ');
set tempstring=replace(tempstring,' proprietary limited ','  ');
set tempstring=replace(tempstring,' cie s a ',' compagnie ');
set tempstring=replace(tempstring,' france s a ',' france ');
set tempstring=replace(tempstring,' u co gmbh ',' company ');
set tempstring=replace(tempstring,' und co gmbh ',' company ');
set tempstring=replace(tempstring,' co gmbh ',' company ');
set tempstring=replace(tempstring,' cie gmbh ',' company ');
set tempstring=replace(tempstring,' gmbh ','  ');
set tempstring=replace(tempstring,' g m b h ','  ');
set tempstring=replace(tempstring,' gesellschaft mit beschraenkter haftung gmbh ','  ');
set tempstring=replace(tempstring,' g mbh ','  ');
set tempstring=replace(tempstring,' g m bh ','  ');
set tempstring=replace(tempstring,' mfg corporation ',' manufacturing corporation ');
set tempstring=replace(tempstring,' et cie s a ',' compagnie ');
set tempstring=replace(tempstring,' et cie sa ',' compagnie ');
set tempstring=replace(tempstring,' cie sa ',' compagnie ');
set tempstring=replace(tempstring,' ci e sa ',' compagnie ');
set tempstring=replace(tempstring,' et co s a ',' company ');
set tempstring=replace(tempstring,' et co sa ',' company ');
set tempstring=replace(tempstring,' co s a ',' company ');
set tempstring=replace(tempstring,' co sa ',' company ');
set tempstring=replace(tempstring,' y cia s a ',' compania ');
set tempstring=replace(tempstring,' cia s a ',' compania ');
set tempstring=replace(tempstring,' inc s a ','  ');
set tempstring=replace(tempstring,' inc sa ','  ');
set tempstring=replace(tempstring,' mfg cy s a ',' manufacturing company ');
set tempstring=replace(tempstring,' cy s a ',' company ');
set tempstring=replace(tempstring,' manufacturin cy s a ',' manufacturing company ');
set tempstring=replace(tempstring,' s a ','  ');
set tempstring=replace(tempstring,' sa ','  ');
set tempstring=replace(tempstring,' e c ',' company ');
set tempstring=replace(tempstring,' p l c ','  ');
set tempstring=replace(tempstring,' l l c ','  ');
set tempstring=replace(tempstring,' c ',' company ');
set tempstring=replace(tempstring,' ges m b h ','  ');
set tempstring=replace(tempstring,' gesellschaft m b h ','  ');
set tempstring=replace(tempstring,' co plc ',' company ');
set tempstring=replace(tempstring,' co p l c ',' company ');
set tempstring=replace(tempstring,' plc ','  ');
set tempstring=replace(tempstring,' pl c ','  ');
set tempstring=replace(tempstring,' et cie sarl ',' compagnie ');
set tempstring=replace(tempstring,' cie sarl ',' compagnie ');
set tempstring=replace(tempstring,' cie s a r l ',' compagnie ');
set tempstring=replace(tempstring,' sarl ','  ');
set tempstring=replace(tempstring,' s a r l ','  ');
set tempstring=replace(tempstring,' s ar l ','  ');
set tempstring=replace(tempstring,' co aktiengesellschaft ',' company ');
set tempstring=replace(tempstring,' a g aktiengesellschaft ','  ');
set tempstring=replace(tempstring,' ag aktiengesellschaft ','  ');
set tempstring=replace(tempstring,' cie aktiengesellschaft ',' compagnie ');
set tempstring=replace(tempstring,' aktiengesellschaft ','  ');
set tempstring=replace(tempstring,' aktiengesell schaft ','  ');
set tempstring=replace(tempstring,' aktien gesellschaft ','  ');
set tempstring=replace(tempstring,' en co n v ',' company ');
set tempstring=replace(tempstring,' en co nv ',' company ');
set tempstring=replace(tempstring,' co n v ',' company ');
set tempstring=replace(tempstring,' n a n v ','  ');
set tempstring=replace(tempstring,' na n v ','  ');
set tempstring=replace(tempstring,' na nv ','  ');
set tempstring=replace(tempstring,' inc n v ','  ');
set tempstring=replace(tempstring,' inc nv ','  ');
set tempstring=replace(tempstring,' corp n v ',' corporation ');
set tempstring=replace(tempstring,' n v ','  ');
set tempstring=replace(tempstring,' nv ','  ');
set tempstring=replace(tempstring,' ltd oy ','  ');
set tempstring=replace(tempstring,' inc oy ','  ');
set tempstring=replace(tempstring,' oy ','  ');
set tempstring=replace(tempstring,' o y ','  ');
set tempstring=replace(tempstring,' s a societe anonyme ','  ');
set tempstring=replace(tempstring,' sa societe anonyme ','  ');
set tempstring=replace(tempstring,' et cie societe anonyme ',' compagnie ');
set tempstring=replace(tempstring,' cie societe anonyme ',' compagnie ');
set tempstring=replace(tempstring,' societe anonyme ','  ');
set tempstring=replace(tempstring,' a societe anonyme ','  ');
set tempstring=replace(tempstring,' french societe anonyme ','  ');
set tempstring=replace(tempstring,' a french societe anonyme ','  ');
set tempstring=replace(tempstring,' soiete anonyme ','  ');
set tempstring=replace(tempstring,' ste anonyme ','  ');
set tempstring=replace(tempstring,' s a soiciete anonyme ','  ');
set tempstring=replace(tempstring,' societey anonyme ','  ');
set tempstring=replace(tempstring,' soci e te anonyme ','  ');
set tempstring=replace(tempstring,' societ e anonyme ','  ');
set tempstring=replace(tempstring,' societete anonyme ','  ');
set tempstring=replace(tempstring,' soci et e anonyme ','  ');
set tempstring=replace(tempstring,' sciete anonyme ','  ');
set tempstring=replace(tempstring,' mfg co a s ',' manufacturing company ');
set tempstring=replace(tempstring,' co a s ',' company ');
set tempstring=replace(tempstring,' co as ',' company ');
set tempstring=replace(tempstring,' ltd a s ','  ');
set tempstring=replace(tempstring,' ltd as ','  ');
set tempstring=replace(tempstring,' a s ','  ');
set tempstring=replace(tempstring,' as ','  ');
set tempstring=replace(tempstring,' co incorporated ',' company ');
set tempstring=replace(tempstring,' incorporated ','  ');
set tempstring=replace(tempstring,' plc a british public limited company ','  ');
set tempstring=replace(tempstring,' public limited company ','  ');
set tempstring=replace(tempstring,' a public limited company ','  ');
set tempstring=replace(tempstring,' ltd a limited company ','  ');
set tempstring=replace(tempstring,' a limited company ','  ');
set tempstring=replace(tempstring,' pubic limited company ','  ');
set tempstring=replace(tempstring,' puplic limited company ','  ');
set tempstring=replace(tempstring,' sarl limited company ','  ');
set tempstring=replace(tempstring,' s r l an italian limited company ','  ');
set tempstring=replace(tempstring,' n v a dutch limited company ','  ');
set tempstring=replace(tempstring,' limited company ','  ');
set tempstring=replace(tempstring,' and company ',' company ');
set tempstring=replace(tempstring,' mfg company ',' manufacturing company ');
set tempstring=replace(tempstring,' mfg co ',' manufacturing company ');
set tempstring=replace(tempstring,' m f g co ',' manufacturing company ');
set tempstring=replace(tempstring,' ltd co ','  ');
set tempstring=replace(tempstring,' gmbh u co ',' company ');
set tempstring=replace(tempstring,' u co ',' company ');
set tempstring=replace(tempstring,' gmbh and co ',' company ');
set tempstring=replace(tempstring,' ag and co ',' company ');
set tempstring=replace(tempstring,' and co ',' company ');
set tempstring=replace(tempstring,' co gmbh co ',' company ');
set tempstring=replace(tempstring,' gmbh co ',' company ');
set tempstring=replace(tempstring,' public limited co ','  ');
set tempstring=replace(tempstring,' n v a dutch limited co ','  ');
set tempstring=replace(tempstring,' limited co ','  ');
set tempstring=replace(tempstring,' gmbh und co ',' company ');
set tempstring=replace(tempstring,' aktiengesellschaft und co ',' company ');
set tempstring=replace(tempstring,' und co ',' company ');
set tempstring=replace(tempstring,' ind co ',' industral company ');
set tempstring=replace(tempstring,' ag co ',' company ');
set tempstring=replace(tempstring,' inc co ',' company ');
set tempstring=replace(tempstring,' co ',' company ');
set tempstring=replace(tempstring,' a g co ',' company ');
set tempstring=replace(tempstring,' aktiengesellschaft co ',' company ');
set tempstring=replace(tempstring,' cie gmbh co ',' company ');
set tempstring=replace(tempstring,' kg gmbh co ',' company ');
set tempstring=replace(tempstring,' k g gmbh co ',' company ');
set tempstring=replace(tempstring,' kommanditges gmbh co ',' company ');
set tempstring=replace(tempstring,' g m b h co ',' company ');
set tempstring=replace(tempstring,' gbmh co ',' company ');
set tempstring=replace(tempstring,' gesellschaft m b h co ',' company ');
set tempstring=replace(tempstring,' ges m b h co ',' company ');
set tempstring=replace(tempstring,' gesellschaft mbh co ',' company ');
set tempstring=replace(tempstring,' mbh co ',' company ');
set tempstring=replace(tempstring,' m b h co ',' company ');
set tempstring=replace(tempstring,' mfg corp ',' manufacturing corporation ');
set tempstring=replace(tempstring,' int l corp ',' international corporation ');
set tempstring=replace(tempstring,' intl corp ',' international corporation ');
set tempstring=replace(tempstring,' corp ',' corporation ');
set tempstring=replace(tempstring,' gmbh co kg ',' company ');
set tempstring=replace(tempstring,' gmbh co k g ',' company ');
set tempstring=replace(tempstring,' cie gmbh u co kg ',' company ');
set tempstring=replace(tempstring,' gesellschaft m b h u co kg ',' company ');
set tempstring=replace(tempstring,' ges m b h u co kg ',' company ');
set tempstring=replace(tempstring,' gmbh u co kg ',' company ');
set tempstring=replace(tempstring,' mbh u co kg ',' company ');
set tempstring=replace(tempstring,' gmbh und co kg ',' company ');
set tempstring=replace(tempstring,' m b h und co kg ',' company ');
set tempstring=replace(tempstring,' und co kg ',' company ');
set tempstring=replace(tempstring,' gmbh and co kg ',' company ');
set tempstring=replace(tempstring,' ag and co kg ',' company ');
set tempstring=replace(tempstring,' gmb o co kg ',' company ');
set tempstring=replace(tempstring,' ges m b h co kg ',' company ');
set tempstring=replace(tempstring,' ag co kg ',' company ');
set tempstring=replace(tempstring,' co gmbh co kg ',' company ');
set tempstring=replace(tempstring,' gesellschaft m b h co kg ',' company ');
set tempstring=replace(tempstring,' gesellschaft mbh co kg ',' company ');
set tempstring=replace(tempstring,' g m b h co kg ',' company ');
set tempstring=replace(tempstring,' gnbh co kg ',' company ');
set tempstring=replace(tempstring,' ges mbh co kg ',' company ');
set tempstring=replace(tempstring,' gesellschaft m b h co k g ',' company ');
set tempstring=replace(tempstring,' ges m h co kg ',' company ');
set tempstring=replace(tempstring,' gesmbh co kg ',' company ');
set tempstring=replace(tempstring,' gmgh co kg ',' company ');
set tempstring=replace(tempstring,' gbmh co kg ',' company ');
set tempstring=replace(tempstring,' g m b h co k g ',' company ');
set tempstring=replace(tempstring,' m b h co k g ',' company ');
set tempstring=replace(tempstring,' mbh co kg ',' company ');
set tempstring=replace(tempstring,' m b h co kg ',' company ');
set tempstring=replace(tempstring,' ag co k g ',' company ');
set tempstring=replace(tempstring,' a g co k g ',' company ');
set tempstring=replace(tempstring,' aktiengesellschaft co kg ',' company ');
set tempstring=replace(tempstring,' b v co kg ',' company ');
set tempstring=replace(tempstring,' kg co kg ',' company ');
set tempstring=replace(tempstring,' co kg ',' company ');
set tempstring=replace(tempstring,' co k g ',' company ');
set tempstring=replace(tempstring,' kg ',' kg ');
set tempstring=replace(tempstring,' k g ',' kg ');
set tempstring=replace(tempstring,' co llc ',' company ');
set tempstring=replace(tempstring,' co l l c ',' company ');
set tempstring=replace(tempstring,' mfg co llc ',' manufacturing company ');
set tempstring=replace(tempstring,' inc llc ',' company ');
set tempstring=replace(tempstring,' inc l l c ',' company ');
set tempstring=replace(tempstring,' mfg llc ','  ');
set tempstring=replace(tempstring,' mfg l l c ','  ');
set tempstring=replace(tempstring,' llc ','  ');
set tempstring=replace(tempstring,' ll c ','  ');
set tempstring=replace(tempstring,' l lc ','  ');
set tempstring=replace(tempstring,' co b v ',' company ');
set tempstring=replace(tempstring,' b v ','  ');
set tempstring=replace(tempstring,' bv ','  ');
set tempstring=replace(tempstring,' oy ab ','  ');
set tempstring=replace(tempstring,' co ab ',' company ');
set tempstring=replace(tempstring,' co a b ',' company ');
set tempstring=replace(tempstring,' aktiebolag ab ','  ');
set tempstring=replace(tempstring,' aktiebolg ab ','  ');
set tempstring=replace(tempstring,' a b ','  ');
set tempstring=replace(tempstring,' ab ','  ');
set tempstring=replace(tempstring,' gmbh co ag ',' company ');
set tempstring=replace(tempstring,' ag co ag ',' company ');
set tempstring=replace(tempstring,' co ag ',' company ');
set tempstring=replace(tempstring,' co a g ',' company ');
set tempstring=replace(tempstring,' cie ag ',' company ');
set tempstring=replace(tempstring,' cie a g ',' company ');
set tempstring=replace(tempstring,' aktiengesellschaft ag ','  ');
set tempstring=replace(tempstring,' ag ','  ');
set tempstring=replace(tempstring,' a g ','  ');
set tempstring=replace(tempstring,' co gesellschaft mbh ',' company ');
set tempstring=replace(tempstring,' co gesellschaft m b h ',' company ');
set tempstring=replace(tempstring,' gesellschaft mbh ','  ');
set tempstring=replace(tempstring,' ges mbh ','  ');
set tempstring=replace(tempstring,' und co mbh ',' company ');
set tempstring=replace(tempstring,' co mbh ',' company ');
set tempstring=replace(tempstring,' m b h ','  ');
set tempstring=replace(tempstring,' mbh ','  ');
set tempstring=replace(tempstring,' kabushiki kaisha ','  ');
set tempstring=replace(tempstring,' yugen kaisha ','  ');
set tempstring=replace(tempstring,' kabusiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushika kaisha ','  ');
set tempstring=replace(tempstring,' kabushi kaisha ','  ');
set tempstring=replace(tempstring,' kubushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabishiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushki kaisha ','  ');
set tempstring=replace(tempstring,' kabushik kaisha ','  ');
set tempstring=replace(tempstring,' kabshiki kaisha ','  ');
set tempstring=replace(tempstring,' kaubshiki kaisha ','  ');
set tempstring=replace(tempstring,' kasbushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushihi kaisha ','  ');
set tempstring=replace(tempstring,' kabuskiki kaisha ','  ');
set tempstring=replace(tempstring,' kabsuhiki kaisha ','  ');
set tempstring=replace(tempstring,' kaushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabuhsiki kaisha ','  ');
set tempstring=replace(tempstring,' kaubushiki kaisha ','  ');
set tempstring=replace(tempstring,' kbushiki kaisha ','  ');
set tempstring=replace(tempstring,' kanushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushkik kaisha ','  ');
set tempstring=replace(tempstring,' kaisha kaisha ','  ');
set tempstring=replace(tempstring,' kabushhiki kaisha ','  ');
set tempstring=replace(tempstring,' kabusgiki kaisha ','  ');
set tempstring=replace(tempstring,' kabusihiki kaisha ','  ');
set tempstring=replace(tempstring,' kabusbiki kaisha ','  ');
set tempstring=replace(tempstring,' kabishuki kaisha ','  ');
set tempstring=replace(tempstring,' kabushikia kaisha ','  ');
set tempstring=replace(tempstring,' kabushiko kaisha ','  ');
set tempstring=replace(tempstring,' kabsushiki kaisha ','  ');
set tempstring=replace(tempstring,' yuugen kaisha ','  ');
set tempstring=replace(tempstring,' kabuhiki kaisha ','  ');
set tempstring=replace(tempstring,' kogyokabushiki kaisha ',' kogyo ');
set tempstring=replace(tempstring,' kabushili kaisha ','  ');
set tempstring=replace(tempstring,' kabushuki kaisha ','  ');
set tempstring=replace(tempstring,' kagushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushiski kaisha ','  ');
set tempstring=replace(tempstring,' kabubshiki kaisha ','  ');
set tempstring=replace(tempstring,' kabukshiki kaisha ','  ');
set tempstring=replace(tempstring,' kaburhiki kaisha ','  ');
set tempstring=replace(tempstring,' kabusahiki kaisha ','  ');
set tempstring=replace(tempstring,' kabuishiki kaisha ','  ');
set tempstring=replace(tempstring,' jabushiki kaisha ','  ');
set tempstring=replace(tempstring,' akbushiki kaisha ','  ');
set tempstring=replace(tempstring,' babushiki kaisha ','  ');
set tempstring=replace(tempstring,' bushiki kaisha ','  ');
set tempstring=replace(tempstring,' dabushiki kaisha ','  ');
set tempstring=replace(tempstring,' denkikabushiki kaisha ',' denki ');
set tempstring=replace(tempstring,' fabushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabhushiki kaisha ','  ');
set tempstring=replace(tempstring,' hatsudokikabushiki kaisha ',' hatsudoki ');
set tempstring=replace(tempstring,' kabsubshiki kaisha ','  ');
set tempstring=replace(tempstring,' jidoshakabushiki kaisha ',' jidosha ');
set tempstring=replace(tempstring,' jukogyokabushiki kaisha ',' jukogyo ');
set tempstring=replace(tempstring,' kabahiki kaisha ','  ');
set tempstring=replace(tempstring,' kabashika kaisha ','  ');
set tempstring=replace(tempstring,' kabasiki kaisha ','  ');
set tempstring=replace(tempstring,' kabbushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabhshiki kaisha ','  ');
set tempstring=replace(tempstring,' kabisha kaisha ','  ');
set tempstring=replace(tempstring,' kabushikiki kaisha ','  ');
set tempstring=replace(tempstring,' kakushiki kaisha ','  ');
set tempstring=replace(tempstring,' katushiki kaisha ','  ');
set tempstring=replace(tempstring,' kebushiki kaisha ','  ');
set tempstring=replace(tempstring,' kebuskiki kaisha ','  ');
set tempstring=replace(tempstring,' kaibushiki kaisha ','  ');
set tempstring=replace(tempstring,' kogyookabushiki kaisha ',' kogyo ');
set tempstring=replace(tempstring,' kaibshiki kaisha ','  ');
set tempstring=replace(tempstring,' labushiki kaisha ','  ');
set tempstring=replace(tempstring,' shokuhinkabushiki kaisha ',' shokuhin ');
set tempstring=replace(tempstring,' kogyolkabushiki kaisha ',' kogyo ');
set tempstring=replace(tempstring,' kabushishi kaisha ','  ');
set tempstring=replace(tempstring,' kabushihiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushiiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushike kaisha ','  ');
set tempstring=replace(tempstring,' kabushikhi kaisha ','  ');
set tempstring=replace(tempstring,' kabushikii kaisha ','  ');
set tempstring=replace(tempstring,' kabushikik kaisha ','  ');
set tempstring=replace(tempstring,' kabushiku kaisha ','  ');
set tempstring=replace(tempstring,' kabushimi kaisha ','  ');
set tempstring=replace(tempstring,' kaishushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushinki kaisha ','  ');
set tempstring=replace(tempstring,' kabushibi kaisha ','  ');
set tempstring=replace(tempstring,' kabushkiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabusihi kaisha ','  ');
set tempstring=replace(tempstring,' kabusshiki kaisha ','  ');
set tempstring=replace(tempstring,' kabusyiki kaisha ','  ');
set tempstring=replace(tempstring,' kabuushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabyshiki kaisha ','  ');
set tempstring=replace(tempstring,' kahushiki kaisha ','  ');
set tempstring=replace(tempstring,' kabushini kaisha ','  ');


set tempstring=mid(tempstring, 2, CHAR_LENGTH(tempstring)-2);

RETURN tempstring;

END;

 $$

DELIMITER ;