Responder a: Similaridade sentenças em dataframes – Similaridade entre sentenças 2

Home Fóruns Fórum Sumarização de Textos com Processamento de Linguagem Natural Similaridade sentenças em dataframes – Similaridade entre sentenças 2 Responder a: Similaridade sentenças em dataframes – Similaridade entre sentenças 2

#35835
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"