ratpmetro/main.py
def _detect_incident(self, tweet):
        """
        Read a tweet message from the RATP official accounts and detect if it announces
        some operational incidents

        Returns:
            bool: Whether the tweet corresponds to an incident
            str: Cause of the incident if applicable, otherwise returns ``N/A``
        """
        if tweet.startswith("RT"):
            return pd.Series(
                [False, "N/A"]
            )  # no incident identified, cause not available
        tweet = tweet.lower()

        for word in self.incident_words:
            negative_word = "n'est pas " + word
            if word in tweet and negative_word not in tweet:
                cause = self._classify_incident_cause(tweet)
                return pd.Series([True, cause])
        else:
            return pd.Series([False, "N/A"])

        Read a tweet message from the RATP official accounts and detect if it announces
        some operational incidents

        Returns:
            bool: Whether the tweet corresponds to an incident
            str: Cause of the incident if applicable, otherwise returns ``N/A``
        
Read a tweet message from the RATP official accounts and detect if it announces
some operational incidents
Read a tweet message from the RATP official accounts and detect if it announces some operational incidents
def _detect_incident(self, tweet):
        if tweet.startswith("RT"):
            return pd.Series(
                [False, "N/A"]
            )  
        tweet = tweet.lower()
        for word in self.incident_words:
            negative_word = "n'est pas " + word
            if word in tweet and negative_word not in tweet:
                cause = self._classify_incident_cause(tweet)
                return pd.Series([True, cause])
        else:
            return pd.Series([False, "N/A"])
def _detect_incident ( self , tweet ) : if tweet . startswith ( "RT" ) : return pd . Series ( [ False , "N/A" ] ) tweet = tweet . lower ( ) for word in self . incident_words : negative_word = "n'est pas " + word if word in tweet and negative_word not in tweet : cause = self . _classify_incident_cause ( tweet ) return pd . Series ( [ True , cause ] ) else : return pd . Series ( [ False , "N/A" ] )
Read a tweet message from the RATP official accounts and detect if it announces
some operational incidents
Read a tweet message from the RATP official accounts and detect if it announces some operational incidents
"""
        Read a tweet message from the RATP official accounts and detect if it announces
        some operational incidents

        Returns:
            bool: Whether the tweet corresponds to an incident
            str: Cause of the incident if applicable, otherwise returns ``N/A``
        """ # no incident identified, cause not available
Whether the tweet corresponds to an incident
str: Cause of the incident if applicable, otherwise returns ``N/A``
Whether the tweet corresponds to an incident str : Cause of the incident if applicable otherwise returns ` ` N / A ` `
bool
self
tweet