Respostas no Fórum

Visualizando 9 posts - 1 até 9 (de 9 do total)
  • Autor
    Posts
  • em resposta a: Medida de importancia de uma tarefa em relaçao ao todo #37211
    Shin
    Participante
      Deu certo. Como saber o quão bom está? Sei do sklearn metrics, mas olhando ele não consigo encontrar nos meus dados y true e y pred.

      Digamos que tenha, agora, duas colunas, uma com a tarefa e a outra com o peso(importância), tu saberias me dizer como utilizar uma métrica para verificar quão bom está?

      em resposta a: Medida de importancia de uma tarefa em relaçao ao todo #36902
      Shin
      Participante

        Se você considerar que todas as tarefas são iguais, sim, mas gostaria de ver a importância delas por meio do tf-idf. Acha que seria possível? Sei que é possível determinar a importância de um termo para um texto, mas queria saber se é possível determinar a importância de uma frase em relação ao documento, ou seja, a importância da tarefa em relação a ocupação, ou se daria para somar a importância de cada termo.

        Shin
        Participante

          Talvez o meu problema seja anterior, na parte de def calcula similaridade

          df1 = {
            "Task1": ["Appoint department heads or managers and assign or delegate responsibilities to them", "Analyze operations to assess the performance of a company or its staff in meeting objectives or to determine areas of potential cost reduction, program improvement, or policy change", "Directing, planning or implementing policies, objectives or activities of organizations or businesses to ensure continuity of operations, maximize return on investment or increase productivity", "Prepare budgets for approval, including those for program funding or implementation", "Establish departmental responsibilities and coordinate roles across departments and sites", "Give speeches, write articles, or present information at meetings or conventions to promote services, exchange ideas, or achieve goals","Prepare or report on activities, expenses, budgets, statutes or government decisions or other items that affect program business or services", "Organize or approve promotional campaigns"]}
          
          #load data into a DataFrame object:
          df1 = pd.DataFrame(df1)
          
          
          
          
          
          
          
          df2 = {  "Task2": ["Define unit to participate in the production process", "Apply resources, according to the company's mission", "Sign agreements, agreements and contracts", "Supervise the execution of commercial, industrial, administrative and financial activity plans", "Interact with government agencies", "Define guidelines for contracting infrastructure services", "Evaluate the quality of the services provided", "Manage purchases and contracts", "Plan strategic actions for people management", "Discuss budget distribution between areas", "Demonstrate oral and written communication skills", "Sign agreements, agreements and contracts"]}
          
          df2 = pd.DataFrame(df2)
          
          df_final = pd.concat([df1,df2], axis=1)
          
          def calcula_matriz_similaridade(sentencas):
            matriz_similaridade = []
          for sent1 in df_final['Task1']:
              vetor_similaridade = []
              for sent2 in df_final['Task2']:
                  vetor_similaridade.append(calcula_similaridade_sentencas(sent1, sent2))
              matriz_similaridade.append(vetor_similaridade)
          matriz_similaridade = np.array(matriz_similaridade)
               
          
          return matriz_similaridade
          apareceu isso 
          
          "expected string or bytes-like object"
          
          
          
          Shin
          Participante

            Denny, eu sou meio burro, entao se tu puder  me dar uma moral eu agradeço. O que tenho que mudar ali na funçao? sentença para sent1? se puder me ajudar…

            def calcula_matriz_similaridade(sentencas):
            matriz_similaridade = np.zeros((len(sentencas), len(sentencas)))
            #print(matriz_similaridade)
            for i in range(len(sentencas)):
            for j in range(len(sentencas)):
            if i == j:
            continue
            matriz_similaridade[i][j] = calcula_similaridade_sentencas(sentencas[i], sentencas[j])

            return matriz_similaridade

            O que mudo aqui?

            Shin
            Participante

              Entendi, mas é que quando eu fiz isso na primeira vez que tentei apareceu isso aqui : name ‘calcula_similaridade_sentencas’ is not defined

              Shin
              Participante

                Esta dando erro de syntax.

                erro

                em resposta a: Visualizar um dataframe atraves do displaCY #34642
                Shin
                Participante

                  Assim, ne displacy.render(Amostra, style = ‘dep’, manual=True) ?
                  Deu a mesma coisa. Tem alguma maneira de tranformar dataframe inteiro ou pelo menos uma coluna de um dataframe em doc?

                  • Esta resposta foi modificada 2 anos, 9 meses atrás por Shin.
                  em resposta a: Dependencia de Parsing de um par Verbo-substantivo #34610
                  Shin
                  Participante

                    CONSEGUI

                    em resposta a: Dependencia de Parsing de um par Verbo-substantivo #34603
                    Shin
                    Participante

                      Humm… Eu que fiz a pergunta outra vez sobre remoção de pontuação.
                      voce pode ver se esta correto entao a maneira como estou fazendo? Gostaria de extrair o par verb- substantivo das frases
                      <

                      task_df = pd.read_excel(r'C:\Users\arquiv\Task Ratings.xlsx')
                      list_task_id = list(set(task_df['Task ID']))
                      
                      nlp = spacy.load('en_core_web_sm')
                      
                      doc = nlp(
                      u'use geospatial technology to develop soil sampling grids or identify sampling sites for testing characteristics such as nitrogen, phosphorus, or potassium content, ph, or micronutrients.')
                      import string
                      string.punctuation
                      
                      def remove_punctuation(Text):
                      punctuationfree="".join([i for i in Text if i not in string.punctuation])
                      return punctuationfree
                      #storing the puntuation free text
                      task_df['clean_msg']= task_df ['Task'].apply(lambda x:remove_punctuation(x))
                      task_df.head()
                      
                      task_df['msg_lower']= task_df['clean_msg'].apply(lambda x: x.lower())
                      task_df['msg_lower']
                      
                      for sent in doc.sents:
                      print([w.text for w in sent if w.dep_ == 'ROOT' or w.dep_ == 'pobj'])
                      from nltk.stem import WordNetLemmatizer
                      
                      lemmatizer = WordNetLemmatizer()
                      def give_pairs(string_):
                      doc = nlp(string_)
                      flag = 0
                      pairs = []
                      for token in doc:
                      # print(token.text, token.pos_, token.dep_)
                      if token.pos_ == 'VERB' and flag == 0:
                      flag = 1
                      xx = token.text
                      if token.pos_ == 'NOUN' and token.dep_ == 'dobj' and flag == 1:
                      pair = []
                      pair.append(lemmatizer.lemmatize(xx))
                      pair.append(lemmatizer.lemmatize(token.text))
                      pairs.append(pair)
                      flag = 0
                      return pairs>
                      • Esta resposta foi modificada 2 anos, 9 meses atrás por Shin.
                    Visualizando 9 posts - 1 até 9 (de 9 do total)