0

TeXドキュメントで英国/ニュージーランドのスペルをアメリカ語に変換するための簡単なBashスクリプトを探しています(米国を拠点とする学者やジャーナルへの提出用)。これは、地域の用語や文法がほとんどない正式な数理生物学の論文です。以前の研究は、引用ではなく式として示されています。

例えば、

Generalise->Generalize

Colour->Color

Centre->Centre

一般的なスペルの違いのほとんどを置き換えるには、Figure there must besedまたはbased script が必要です。awk

詳細については、関連する TeX フォーラムの質問を参照してください。

https://tex.stackexchange.com/questions/312138/converting-uk-to-us-spellings

nb現在、Ubuntu 16.04またはElementary OS 0.3 FreyaでPDFLaTeXをコンパイルしていますkileが、他の場所に組み込みの修正がある場合は、別のTeXコンパイラ/パッケージを使用できます。

ご協力ありがとうございます。

4

2 に答える 2

1

置換のリストを手元に用意して、翻訳のために呼び出す必要があると思います。テキスト ファイルを効率的に翻訳するには、辞書ファイルを充実させる必要があります。

sourceFile=$1
dict=$2

while read line
    do
     word=$(echo $line |awk '{print $1}')
     updatedWord=$(grep -i $word $dict|awk '{print $2}')

     sed -i "s/$word/$updatedWord/g" $sourceFile 2 > /dev/null

   done < $dict

上記のスクリプトを次のように実行します。

./scriptName source.txt dictionary.txt 

以下は、私が使用したサンプル辞書の 1 つです。

>cat dict
characterize characterise
prioritize prioritise
specialize specialise
analyze analyse
catalyze catalyse
size size
exercise exercise
behavior behaviour
color colour
favor favour
contour contour
center centre
fiber fibre
liter litre
parameter parameter
ameba amoeba
anesthesia anaesthesia
diarrhea diarrhoea
esophagus oesophagus
leukemia leukaemia
cesium caesium
defense defence
practice  practice
license  licence
defensive defensive
advice  advice
aging ageing
acknowledgment acknowledgement
judgment judgement
analog analogue
dialog dialogue
fulfill fulfil
enroll enrol
skill, skillful skill, skilful
labeled labelled
signaling signalling
propelled propelled
revealing revealing

実行結果:

cat source
color of this fiber is great and we should analyze it.

./ScriptName source.txt dict.txt

cat source
colour of this fibre is great and we should analyse it.
于 2016-06-01T08:58:56.237 に答える