escribe un metodo en python que descarte de un texto toda esa parte que simplemente no forma parte de un parrafo normal de explicaciones sino que forma parte de menus o otra cosa. Te pongo un ejemplo en este texto: "ublished:
23 May 2007
PDF
Split View
Views
Article contents
Figures & tables
Video
Audio
Supplementary Data
Cite
Cite
Kurtuluş Gemici, Karl Polanyi and the antinomies of embeddedness, Socio-Economic Review, Volume 6, Issue 1, January 2008, Pages 5–33, https://doi.org/10.1093/ser/mwl034
Select Format
Select format
.ris (Mendeley, Papers, Zotero)
.enw (EndNote)
.bibtex (BibTex)
.txt (Medlars, RefWorks)
Download citation
Close
Permissions Icon
Permissions
Share Icon
Share
Facebook
Twitter
LinkedIn
Email
Navbar Search Filter
Socio-Economic ReviewThis issue
Economic SociologyEconomicsPolitical EconomyBooksJournalsOxford Academic
Mobile Enter search term
Search
Close
Navbar Search Filter
Socio-Economic ReviewThis issue
Economic SociologyEconomicsPolitical EconomyBooksJournalsOxford Academic
Enter search term
Search
Advanced Search
Search Menu
Abstract
While Polanyi argues that all economies are embedded and enmeshed in social relations and institutions, he tends to see market economy as disembedded, which reveals a tension in his thought. The main motivation for this paper is to understand the origins of this tension. On the basis of a systematic formulation of Polanyi's work, it is argued that Polanyi employs embeddedness in a dual manner: (a) as a methodological principle akin to methodological holism, and (b) as a theoretical proposition on the changing place of economy in society. These two formulations of embeddedness contradict each other. After tracing out the origins of this contradiction, this paper concludes by considering the implications of this analysis for economic sociology. It is argued that embeddedness as a methodological principle is the only acceptable usage of the term. Yet, in this capacity, embeddedness falls short of economic sociology's goal of providing a theoretical alternative to neoclassical economics.
Introduction
Schumpeter (1954, p. 21), in a frequently quoted passage, presents the intellectual division of labour between economics and economic sociology in the following manner: ‘Economic analysis deals with the questions how people behave at any time and what the economic effects are they produce by so behaving; economic sociology deals with the question how they came to behave as they do’.Karl Polanyi would disagree. He would argue that the real distinction between economics and any other social science concerned with economic life is that economics dictates an image of the economy derived from a utopian ideal on all empirical economies in history. Such an ideology, according to Polanyi, is not only obsolete but also destructive in its promotion of self-regulating markets, simply because economies—past and present—are embedded and enmeshed in social relations and institutions. Economics and its ‘obsolete mentality’ are valid as long as one is sufficiently myopic to see the unsustainable market system of the 19th century in all economic life. The ‘self-acting device’ of the 19th century—the market system—cannot be the reference point for grasping ‘the reality of society’ in economic life because, before its rise, markets were isolated and regulated by other social institutions.Polanyi's critique of economics is enduring; his embeddedness c
Select Format
Select format
.ris (Mendeley, Papers, Zotero)
.enw (EndNote)
.bibtex (BibTex)
.txt (Medlars, RefWorks)
Download citation
Close
Permissions Icon
Permissions
Share Icon
Share
Facebook
Twitter", No me interesa la parte de arriba que solo hay palabras pero no tiene un sentido para el lector, y mas abajo tambien cuando empieza con: "Select Format
Select format
.ris (Mendeley, Papers, Zotero)
.enw (EndNote)
.bibtex (BibTex)
.txt (Medlars, RefWorks)
Download citation
Close
Permissions Icon
Permissions
Share Icon
Share
Facebook
Twitter", como lo harías?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Para resolver este problema, podemos utilizar una combinación de técnicas de procesamiento de texto en Python. La idea principal es identificar y eliminar las secciones que parecen ser parte de menús, botones o elementos de la interfaz de usuario, dejando sólo los párrafos explicativos que tienen sentido para el lector.
A continuación, te presento un método en Python que realiza esta tarea utilizando expresiones regulares y lógica de filtrado basada en patrones comunes encontrados en menús y elementos de UI.
python
import re
def filtrar_parrafos(texto):
"""
Filtra las secciones del texto que no forman parte de un párrafo explicativo normal.
Args:
texto (str): Texto de entrada que contiene contenido y posibles menús o elementos de UI.
Returns:
str: Texto filtrado que contiene sólo los párrafos explicativos.
"""
# Definir palabras clave que suelen aparecer en menús y elementos de UI
palabras_clave = [
'Select Format', 'Download citation', 'Close', 'Permissions',
'Share', 'Facebook', 'Twitter', 'LinkedIn', 'Email',
'Search', 'Abstract', 'Introduction', 'Figure', 'Table',
'Icon', 'Menu', 'View', 'Navigate', 'Filter', 'Advanced Search'
]
# Compilar una expresión regular para detectar líneas que contienen solo palabras clave
regex_menu = re.compile(r'^\s*(' + '|'.join(re.escape(pal) for pal in palabras_clave) + r')\s*$', re.IGNORECASE)
# Dividir el texto en líneas
lineas = texto.split('\n')
# Variable para controlar si estamos en la sección de contenido principal
en_contenido = False
contenido_filtrado = []
for linea in lineas:
linea_limpia = linea.strip()
# Comenzar a capturar contenido cuando se encuentra 'Abstract' o 'Introduction'
if re.match(r'^(Abstract|1\. Introduction)', linea_limpia, re.IGNORECASE):
en_contenido = True
if en_contenido:
# Detener la captura si se encuentran menús comunes
if regex_menu.match(linea_limpia):
en_contenido = False
continue
# Ignorar líneas muy cortas que probablemente no son contenido relevante
if len(linea_limpia) < 20:
continue
# Agregar la línea al contenido filtrado
contenido_filtrado.append(linea_limpia)
# Unir las líneas filtradas en un solo texto
texto_filtrado = '\n'.join(contenido_filtrado)
return texto_filtrado
# Ejemplo de uso
texto_original = """
ublished:
23 May 2007
PDF
Split View
Views
Article contents
Figures & tables
Video
Audio
Supplementary Data
Cite
Cite
Kurtuluş Gemici, Karl Polanyi and the antinomies of embeddedness, Socio-Economic Review, Volume 6, Issue 1, January 2008, Pages 5–33, https://doi.org/10.1093/ser/mwl034
Select Format
Select format
.ris (Mendeley, Papers, Zotero)
.enw (EndNote)
.bibtex (BibTex)
.txt (Medlars, RefWorks)
Download citation
Close
Permissions Icon
Permissions
Share Icon
Share
Facebook
Twitter
LinkedIn
Email
Navbar Search Filter
Socio-Economic ReviewThis issue
Economic SociologyEconomicsPolitical EconomyBooksJournalsOxford Academic
Mobile Enter search term
Search
Close
Navbar Search Filter
Socio-Economic ReviewThis issue
Economic SociologyEconomicsPolitical EconomyBooksJournalsOxford Academic
Enter search term
Search
Advanced Search
Search Menu
Abstract
While Polanyi argues that all economies are embedded and enmeshed in social relations and institutions, he tends to see market economy as disembedded, which reveals a tension in his thought. The main motivation for this paper is to understand the origins of this tension. On the basis of a systematic formulation of Polanyi's work, it is argued that Polanyi employs embeddedness in a dual manner: (a) as a methodological principle akin to methodological holism, and (b) as a theoretical proposition on the changing place of economy in society. These two formulations of embeddedness contradict each other. After tracing out the origins of this contradiction, this paper concludes by considering the implications of this analysis for economic sociology. It is argued that embeddedness as a methodological principle is the only acceptable usage of the term. Yet, in this capacity, embeddedness falls short of economic sociology's goal of providing a theoretical alternative to neoclassical economics.
1. Introduction
Schumpeter (1954, p. 21), in a frequently quoted passage, presents the intellectual division of labour between economics and economic sociology in the following manner: ‘Economic analysis deals with the questions how people behave at any time and what the economic effects are they produce by so behaving; economic sociology deals with the question how they came to behave as they do’.Karl Polanyi would disagree. He would argue that the real distinction between economics and any other social science concerned with economic life is that economics dictates an image of the economy derived from a utopian ideal on all empirical economies in history. Such an ideology, according to Polanyi, is not only obsolete but also destructive in its promotion of self-regulating markets, simply because economies—past and present—are embedded and enmeshed in social relations and institutions. Economics and its ‘obsolete mentality’ are valid as long as one is sufficiently myopic to see the unsustainable market system of the 19th century in all economic life. The ‘self-acting device’ of the 19th century—the market system—cannot be the reference point for grasping ‘the reality of society’ in economic life because, before its rise, markets were isolated and regulated by other social institutions.Polanyi's critique of economics is enduring; his embeddedness c
Select Format
Select format
.ris (Mendeley, Papers, Zotero)
.enw (EndNote)
.bibtex (BibTex)
.txt (Medlars, RefWorks)
Download citation
Close
Permissions Icon
Permissions
Share Icon
Share
Facebook
Twitter
"""
texto_filtrado = filtrar_parrafos(texto_original)
print(texto_filtrado)
Explicación del Método
Identificación de Palabras Clave:
Se define una lista de palabras o frases que comúnmente aparecen en menús o elementos de la interfaz de usuario, como "Select Format", "Download citation", "Share", "Facebook", etc.
Compilación de Expresiones Regulares:
Se crea una expresión regular (regex_menu) que detecta líneas que contienen únicamente alguna de las palabras clave mencionadas. Esto ayuda a identificar y filtrar automáticamente estas secciones no deseadas.
Procesamiento del Texto:
El texto se divide en líneas individuales para su análisis.
Se utiliza una variable de control (en_contenido) para determinar cuándo comienza y termina la sección de contenido principal.
El contenido principal se asume que comienza cuando se encuentra una línea que inicia con "Abstract" o "1. Introduction".
Dentro de la sección de contenido, se filtran las líneas que coinciden con la expresión regular de menú y se ignoran las líneas muy cortas que probablemente no contienen información relevante.
Filtrado y Reconstrucción del Texto:
Las líneas que no se filtran se agregan a una lista (contenido_filtrado), que luego se une para formar el texto final filtrado.
Resultado
El resultado de este método será el texto que contiene únicamente los párrafos explicativos, eliminando todas las secciones que parecen ser parte de menús o elementos de la interfaz de usuario. Por ejemplo, utilizando el texto proporcionado, el resultado será:
code
Abstract
While Polanyi argues that all economies are embedded and enmeshed in social relations and institutions, he tends to see market economy as disembedded, which reveals a tension in his thought. The main motivation for this paper is to understand the origins of this tension. On the basis of a systematic formulation of Polanyi's work, it is argued that Polanyi employs embeddedness in a dual manner: (a) as a methodological principle akin to methodological holism, and (b) as a theoretical proposition on the changing place of economy in society. These two formulations of embeddedness contradict each other. After tracing out the origins of this contradiction, this paper concludes by considering the implications of this analysis for economic sociology. It is argued that embeddedness as a methodological principle is the only acceptable usage of the term. Yet, in this capacity, embeddedness falls short of economic sociology's goal of providing a theoretical alternative to neoclassical economics.
1. Introduction
Schumpeter (1954, p. 21), in a frequently quoted passage, presents the intellectual division of labour between economics and economic sociology in the following manner: ‘Economic analysis deals with the questions how people behave at any time and what the economic effects are they produce by so behaving; economic sociology deals with the question how they came to behave as they do’.Karl Polanyi would disagree. He would argue that the real distinction between economics and any other social science concerned with economic life is that economics dictates an image of the economy derived from a utopian ideal on all empirical economies in history. Such an ideology, according to Polanyi, is not only obsolete but also destructive in its promotion of self-regulating markets, simply because economies—past and present—are embedded and enmeshed in social relations and institutions. Economics and its ‘obsolete mentality’ are valid as long as one is sufficiently myopic to see the unsustainable market system of the 19th century in all economic life. The ‘self-acting device’ of the 19th century—the market system—cannot be the reference point for grasping ‘the reality of society’ in economic life because, before its rise, markets were isolated and regulated by other social institutions.Polanyi's critique of economics is enduring; his embeddedness c
Consideraciones Adicionales
Adaptabilidad: Este método utiliza una lista de palabras clave que pueden necesitar ajustarse según el tipo de documentos que estés procesando. Es posible que necesites agregar o eliminar palabras clave para mejorar la precisión del filtrado.
Expresiones Regulares: Las expresiones regulares utilizadas son sensibles a mayúsculas y minúsculas gracias al flag re.IGNORECASE. Esto asegura que se detecten correctamente las palabras clave sin importar su capitalización en el texto.
Extensibilidad: Para documentos más complejos, podrías considerar el uso de técnicas avanzadas de procesamiento de lenguaje natural (NLP) o incluso bibliotecas especializadas como spaCy o nltk para una extracción de texto más precisa.
Espero que este método te sea de ayuda para filtrar y limpiar tus textos eliminando las secciones no deseadas.