11
In my example I have two classes that are SetorInteresse
and Vaga
, below follows the structure of the two:
Setorinteresse class:
public class SetorInteresse {
private List<String> setores;
public SetorInteresse(List<String> setores) {
this.setores = setores;
}
public SetorInteresse() { }
public void addPalavra(String palavra) { setores.add(palavra); }
public void removePalavra(String palavra) { setores.remove(palavra); }
public List<String> getSetores() { return setores; }
}
Vaga Class:
public class Vaga {
private String tituloVaga;
private String setor;
private String funcao;
public Vaga(String tituloVaga, String setor, String funcao) {
this.tituloVaga = tituloVaga;
this.setor = setor;
this.funcao = funcao;
}
public Vaga() { }
public String getDescricaoVaga() {
return tituloVaga;
}
public void setDescricaoVaga(String tituloVaga) { this.tituloVaga = tituloVaga; }
public String getSetor() { return setor; }
public void setSetor(String setor) { this.setor = setor; }
public String getFuncao() { return funcao; }
public void setFuncao(String funcao) { this.funcao = funcao; }
}
Below I have two methods one that populates the variable vagas
type List<Vaga>
and the other that populates the attribute setores
of the object SetorInteresse
see:
Method populating the variable vagas
:
List<Vaga> vagas = criaVagas();
...
static List<Vaga> criaVagas() {
List<Vaga> vagas = new ArrayList<>();
vagas.add(new Vaga("Desenvolvedor Java", "Tecnologia da Informação", "Desenvolvedor"));
vagas.add(new Vaga("Desenvolvedor C# e Web", "Tecnologia da Informação", "Desenvolvedor"));
vagas.add(new Vaga("Motorista Carreteiro", "Logistica", "Motorista"));
vagas.add(new Vaga("Gerente de Sistemas", "Tecnologia da Informação", "Desenvolvedor"));
vagas.add(new Vaga("Estágiario Tecnologia da Informação", "Tecnologia da Informação", "Estágiario"));
vagas.add(new Vaga("Analista de Sistemas", "Tecnologia da Informação", "Analista"));
vagas.add(new Vaga("Suporte Técnico", "Suporte", "Suporte"));
vagas.add(new Vaga("Gerente Comercial", "Departamento Administrativo", "Gerente"));
vagas.add(new Vaga("Assistente de Recursos Humanos", "Recursos Humanos RH", "Aissistente"));
return vagas;
}
Method populating the attribute setores
:
SetorInteresse setorInteresse = criaSetorInteresse();
...
static SetorInteresse criaSetorInteresse() {
SetorInteresse setorInteresse = new SetorInteresse();
setorInteresse.addPalavra("Desenvolvimento de programas");
setorInteresse.addPalavra("Tecnologia da informação e serviços");
setorInteresse.addPalavra("Análise de sistemas");
return setorInteresse;
}
Based on the data that were entered in the two variables vagas
and setorInteresse
i wonder if there is any way in which I could create a filter that returns me only the list objects vagas
where the value of the attribute setor
of the object Vaga
relates to any of the words or phrase in the attribute setores
or if there is any alternative to this?
Example, if I have the following value in my attribute sectors:
Programme development
I would get all type objects Vaga
where the value of the attribute setor
is related to Desenvolvimento de programas
, in this case the vacancies I would receive would be:
Java developer
Developer C# and Web
System Manager
Estágiario Information Technology
Systems Analyst
Technical Support
Thus the vacancies displayed would be according to the interests defined in the attribute setores
.
There is a way to create a filter that gives me those results or there is a library that does that for me. And I would also like to know what criteria I should define in the relationship between the words/phrases and how to define them, if necessary?
To search intelligently you will probably have to query by similarity, similar to Google that gives that message: "Did you mean ...". First I’d have to share the word with
split
and delete words with 2 or 3 characters (from, with, do, in), then you would have to use an algorithm to compare word by word, such aslevenshtein
orhamming
. The words in the sectors would all have to find similar in vacancies, but vacancies may have extra words, I believe.– Guilherme Nascimento
Would the filter receive a text with the supposed sector to be considered or would the sector be selected from predefined options? I ask this because if it is the alternative 2 has a much more elegant way of solving your problem.
– Giuliana Bezerra
@Giulianabezerra the intention is to analyze the text and put in a filter after the analysis, however, if it is too complex this analysis I could define a few words for the filter... I’m looking for alternatives :)
– gato
Are you using Java 8? :P
– Giuliana Bezerra
@Giulianabezerra yes, I forgot to mention.
– gato