Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 什么';这是去';规范化&x27;红移的字符串?_Sql_String_Amazon Web Services_Replace_Amazon Redshift - Fatal编程技术网

Sql 什么';这是去';规范化&x27;红移的字符串?

Sql 什么';这是去';规范化&x27;红移的字符串?,sql,string,amazon-web-services,replace,amazon-redshift,Sql,String,Amazon Web Services,Replace,Amazon Redshift,因为我的文本是葡萄牙语的,所以有很多带有口音和其他特殊字符的单词,比如:“科拉萨昂”、“哈姆布尔”、“圣保罗” 通常,我使用以下函数在Python中处理这些名称: from unicodedata import normalize def string_normalizer(text): result = normalize("NFKD", text.lower()).encode("ASCII", "ignore").dec

因为我的文本是葡萄牙语的,所以有很多带有口音和其他特殊字符的单词,比如:“科拉萨昂”、“哈姆布尔”、“圣保罗”

通常,我使用以下函数在Python中处理这些名称:

from unicodedata import normalize

def string_normalizer(text):
    result = normalize("NFKD", text.lower()).encode("ASCII", "ignore").decode("ASCII")
    return result.replace(" ", "-")

这将用“--”替换空白空间,替换特殊字符并应用小写转换。“coração”一词将变成“coracao”,“圣保罗”将变成“圣保罗”等等。现在,我不确定在红移中最好的方法是什么。我的解决方案是应用多个替换,如下所示:

replace(replace(replace(lower(column), 'á', 'a'), 'ç', 'c')...
尽管这样做有效,但看起来并不是最好的解决方案。有没有一种简单的方法来规范化我的字符串