英国英语到美国英语(反之亦然)转换器

时间:2021-04-23 19:34:24

Does anyone know of a library or bit of code that converts British English to American English and vice versa?

有没有人知道将英国英语转换成美式英语的图书馆或代码,反之亦然?

I don't imagine there's too many differences (some examples that come to mind are doughnut/donut, colour/color, grey/gray, localised/localized) but it would be nice to be able to provide localised site content.

我不认为有太多的差异(想到的一些例子是甜甜圈/甜甜圈,颜色/颜色,灰色/灰色,本地化/本地化)但是能够提供本地化的网站内容会很好。

5 个解决方案

#1


7  

I've been working on one to convert US English to UK English. As I've discovered it's actually a lot harder to write something to convert the other way but I hope to get around to providing a reverse conversion one day.

我一直致力于将美国英语转换成英国英语。正如我发现的那样,用其他方式编写一些内容实际上要困难得多,但我希望有一天能够提供反向转换。

This isn't perfect, but it's not a bad effort (even if I do say so myself). It'll convert most US spellings to UK ones but there are some words where UK English retains the US spelling (e.g. "program" where this refers to computer software). It won't convert words like pants to trousers because my main goal was simply to make the spelling uniform across the whole document.

这并不完美,但这并不是一件坏事(即使我自己这么说)。它会将大多数美国拼写转换为英国拼写,但有一些词语表明英国英语保留了美国拼写(例如“程序”,其中指的是计算机软件)。它不会将像裤子这样的单词转换成裤子,因为我的主要目标只是使整个文档中的拼写统一。

There are also words such as practice and license where UK English uses either those or practise & licence, depending on whether the word's being used as a verb or a noun. For those two examples the conversion tool will highlight them and an explanatory note pops up on the lower left hand of your screen when you hover your mouse over them. All word patterns which are converted are underlined in red, and the output is shown in a side by side comparison with your original input.

还有一些单词,如练习和执照,英国英语使用这些或练习和执照,这取决于单词是用作动词还是名词。对于这两个示例,转换工具将突出显示它们,当您将鼠标悬停在屏幕左下方时,屏幕左下角会弹出一条解释性说明。所有转换的字模式都用红色加下划线,输出与原始输入并排显示。

It'll do quite large blocks of text quite quickly, but I prefer to go use it just for a couple of paragraphs at a time - copying them in from a Word doc.

它会很快地完成相当大的文本块,但我更喜欢一次只使用几段 - 从Word文档复制它们。

It's still a work in progress so if anyone has any comments or suggestions then I'd appreciate feedback I can use to improve it.

它仍然是一项正在进行的工作,所以如果有人有任何意见或建议,那么我会感谢我可以用来改进它的反馈。

http://www.us2uk.eu/

#2


2  

I think if you're thinking of converting from American English to British English, I personally wouldn't bother. Britain is very Americanised anyway, we accept silly yank spellings on the net :)

我想如果你想从美国英语转换成英国英语,我个人不会打扰。无论如何英国非常美国化,我们在网上接受愚蠢的猛拉拼写:)

#3


1  

The difference between UK and US English is far greater than just a difference in spelling. There is also the hood/bonnet, sidewalk/pavement, pants/trousers idea.

英国和美国英语之间的差异远大于拼写上的差异。还有发动机罩/发动机罩,人行道/人行道,裤子/裤子的想法。

Guess it depends how far you need to take it.

猜猜这取决于你需要走多远。

#4


1  

I had a similar problem recently. I discovered the following tool, called VarCon. I haven't tested it out, but I needed a rough converter for some text data. Here's an example.

我最近遇到了类似的问题。我发现了以下工具,称为VarCon。我还没有测试过,但我需要一个粗略的转换器来处理一些文本数据。这是一个例子。

echo "I apologise for my colourful tongue ." | ./translate british american
# >> I apologize for my colorful tongue .

It looks like it works for various dialects. Be sure to read the README and proceed with caution.

看起来它适用于各种方言。请务必阅读自述文件并谨慎行事。

*note: This will only correct spelling variations.

*注意:这只会纠正拼写错误。

#5


1  

I looked forever to find a solution to this, but couldn't find one, so, I wrote my own bit of code for it, using a master list of ~20,000 different spellings that were freely available from the varcon project and the language experts at wordsworldwide:

我永远寻找一个解决方案,但找不到一个,所以,我为它编写了我自己的一些代码,使用了一个大纲列表,其中有大约20,000种不同的拼写,可以从varcon项目和语言专家那里免费获得在wordsworldwide:

https://github.com/HoldOffHunger/convert-british-to-american-spellings

Since I had two source lists, I used them each to crosscheck each other, and I found numerous errors and typos (varcon lists "preexistent"'s british equivalent as "preaexistent"). It is possible that I may have accidentally made typos, too, but, since I didn't do any wordsmithing here, I don't believe that to be the case.

由于我有两个源列表,我使用它们互相交叉检查,我发现了很多错误和拼写错误(varcon列出“preexistent”的英语等同于“preaexistent”)。我可能也不小心犯了拼写错误,但是,由于我没有在这里做任何文字,我不相信是这样的。

Example:

require('AmericanBritishSpellings.php');
$american_british_spellings = new AmericanBritishSpellings();

$text = "Axiomatically ax that door, would you, my neighbour?";
$text = $american_british_spellings->SwapBritishSpellingsForAmericanSpellings(['text'=>$text]);

print($text);   // output: Axiomatically axe that door, would you, my neighbor?

#1


7  

I've been working on one to convert US English to UK English. As I've discovered it's actually a lot harder to write something to convert the other way but I hope to get around to providing a reverse conversion one day.

我一直致力于将美国英语转换成英国英语。正如我发现的那样,用其他方式编写一些内容实际上要困难得多,但我希望有一天能够提供反向转换。

This isn't perfect, but it's not a bad effort (even if I do say so myself). It'll convert most US spellings to UK ones but there are some words where UK English retains the US spelling (e.g. "program" where this refers to computer software). It won't convert words like pants to trousers because my main goal was simply to make the spelling uniform across the whole document.

这并不完美,但这并不是一件坏事(即使我自己这么说)。它会将大多数美国拼写转换为英国拼写,但有一些词语表明英国英语保留了美国拼写(例如“程序”,其中指的是计算机软件)。它不会将像裤子这样的单词转换成裤子,因为我的主要目标只是使整个文档中的拼写统一。

There are also words such as practice and license where UK English uses either those or practise & licence, depending on whether the word's being used as a verb or a noun. For those two examples the conversion tool will highlight them and an explanatory note pops up on the lower left hand of your screen when you hover your mouse over them. All word patterns which are converted are underlined in red, and the output is shown in a side by side comparison with your original input.

还有一些单词,如练习和执照,英国英语使用这些或练习和执照,这取决于单词是用作动词还是名词。对于这两个示例,转换工具将突出显示它们,当您将鼠标悬停在屏幕左下方时,屏幕左下角会弹出一条解释性说明。所有转换的字模式都用红色加下划线,输出与原始输入并排显示。

It'll do quite large blocks of text quite quickly, but I prefer to go use it just for a couple of paragraphs at a time - copying them in from a Word doc.

它会很快地完成相当大的文本块,但我更喜欢一次只使用几段 - 从Word文档复制它们。

It's still a work in progress so if anyone has any comments or suggestions then I'd appreciate feedback I can use to improve it.

它仍然是一项正在进行的工作,所以如果有人有任何意见或建议,那么我会感谢我可以用来改进它的反馈。

http://www.us2uk.eu/

#2


2  

I think if you're thinking of converting from American English to British English, I personally wouldn't bother. Britain is very Americanised anyway, we accept silly yank spellings on the net :)

我想如果你想从美国英语转换成英国英语,我个人不会打扰。无论如何英国非常美国化,我们在网上接受愚蠢的猛拉拼写:)

#3


1  

The difference between UK and US English is far greater than just a difference in spelling. There is also the hood/bonnet, sidewalk/pavement, pants/trousers idea.

英国和美国英语之间的差异远大于拼写上的差异。还有发动机罩/发动机罩,人行道/人行道,裤子/裤子的想法。

Guess it depends how far you need to take it.

猜猜这取决于你需要走多远。

#4


1  

I had a similar problem recently. I discovered the following tool, called VarCon. I haven't tested it out, but I needed a rough converter for some text data. Here's an example.

我最近遇到了类似的问题。我发现了以下工具,称为VarCon。我还没有测试过,但我需要一个粗略的转换器来处理一些文本数据。这是一个例子。

echo "I apologise for my colourful tongue ." | ./translate british american
# >> I apologize for my colorful tongue .

It looks like it works for various dialects. Be sure to read the README and proceed with caution.

看起来它适用于各种方言。请务必阅读自述文件并谨慎行事。

*note: This will only correct spelling variations.

*注意:这只会纠正拼写错误。

#5


1  

I looked forever to find a solution to this, but couldn't find one, so, I wrote my own bit of code for it, using a master list of ~20,000 different spellings that were freely available from the varcon project and the language experts at wordsworldwide:

我永远寻找一个解决方案,但找不到一个,所以,我为它编写了我自己的一些代码,使用了一个大纲列表,其中有大约20,000种不同的拼写,可以从varcon项目和语言专家那里免费获得在wordsworldwide:

https://github.com/HoldOffHunger/convert-british-to-american-spellings

Since I had two source lists, I used them each to crosscheck each other, and I found numerous errors and typos (varcon lists "preexistent"'s british equivalent as "preaexistent"). It is possible that I may have accidentally made typos, too, but, since I didn't do any wordsmithing here, I don't believe that to be the case.

由于我有两个源列表,我使用它们互相交叉检查,我发现了很多错误和拼写错误(varcon列出“preexistent”的英语等同于“preaexistent”)。我可能也不小心犯了拼写错误,但是,由于我没有在这里做任何文字,我不相信是这样的。

Example:

require('AmericanBritishSpellings.php');
$american_british_spellings = new AmericanBritishSpellings();

$text = "Axiomatically ax that door, would you, my neighbour?";
$text = $american_british_spellings->SwapBritishSpellingsForAmericanSpellings(['text'=>$text]);

print($text);   // output: Axiomatically axe that door, would you, my neighbor?