我是预测分析的新手。我试图从不同的地址提取国家代码(ISO)。我有一个包含所有可能国家/地区(dbname:Geo)的数据库及其各自的ISO代码。 我正在尝试使用Rapid Miner或R作为起点(以及SQL)
例如:
地址:123 Main St 54321 US / CA.
结果:1)US 2)CA
制作预测模型以查找国家/地区名称的最佳方法是什么?
现在我只使用sql:
DECLARE db_cursor_country CURSOR
FOR
SELECT COUNTRY_NAME
FROM TScotiaCountryUpdated
--WHERE CHARINDEX(' ',COUNTRY_NAME,0) > 0
OPEN db_cursor_country;
FETCH NEXT FROM db_cursor_country INTO @Country
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO TCountryNameMatch
SELECT FT.[Rank] ,
TPartyNameAddress.PartyNameAddress,
@Country AS Country_Name,
CC_ISO
,CASE WHEN RIGHT(PartyNameAddress, 20) LIKE '%UNITED STATES%' OR PartyNameAddress LIKE '%NEW YORK%' THEN 'Y' ELSE NULL END AS USFlag
--INTO dbo.TCountryNameMatch
FROM TPartyNameAddress
INNER JOIN CONTAINSTABLE(TPartyNameAddress, PartyNameAddress, @Country) FT ON FT.[Key] = TPartyNameAddress.ID
INNER JOIN TScotiaCountryUpdated ON @Country= COUNTRY_NAME
PRINT @Country
FETCH NEXT FROM db_cursor_country INTO @Country
END;
CLOSE db_cursor_country;
DEALLOCATE db_cursor_country;`