I’ve never done anything like this, but from what I understand of your doubt, I’d start with a code like this:
class Program
{
static void Main(string[] args)
{
List<Dicionario> dicionario = new List<Dicionario>();
//Carrega o dicionário
string texto = @"texto gigante aqui
era uma vez, blabla bla";
string novoTexto = "";
string[] linhas = texto.Split('\r');
for (int l = 0; l < linhas.Length;l++)
{
string[] palavras = linhas[l].Split(' ');
for (int p = 0; p < palavras.Length; p++)
{
Dicionario d = dicionario.Find(x => x.Palavra.ToUpper() == palavras[p].ToUpper());
if (d != null)
palavras[p] = d.Abreviacao;
novoTexto += palavras[p] + " ";
}
novoTexto += "\r";
}
//Seu novo texto
Console.Write(novoTexto);
}
class Dicionario
{
public string Palavra { get; set; }
public string Abreviacao { get; set; }
}
}
then I would do performance tests to try to improve something and see if this is really what you need.
hope I’ve helped
It’s C# or VB.NET?
– Jéf Bueno
It is csharp, to define whether it will be web.api or Ws or wcf
– hard123
Hello Adriano. This dictionary has how many abbreviations, approximately?
– Randrade
So far 300 abbreviations
– hard123
some progress ?
– Rovann Linhalis
Hello @Rovann Linhalis, I had to be directed to another activity and as soon as I can I will implement this suggestion and do some performance tests, as soon as I resume I give a feedback.
– hard123