<commit_before># -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013 - 2018 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

from superdesk.io.feed_parsers.newsml_2_0 import NewsMLTwoFeedParser
from superdesk.io.registry import register_feed_parser
from superdesk.errors import ParserError
from superdesk.metadata.item import CONTENT_TYPE
from superdesk import etree as sd_etree
from . import utils
import dateutil.parser
import logging

logger = logging.getLogger(__name__)
NS = {'xhtml': 'http://www.w3.org/1999/xhtml',
      'iptc': 'http://iptc.org/std/nar/2006-10-01/'}


class DPANewsMLFeedParser(NewsMLTwoFeedParser):
    """
    Feed Parser which can parse DPA variant of NewsML
    """

    NAME = 'dpanewsml'
    label = "DPA NewsML"

    def can_parse(self, xml):
        return xml.tag.endswith('newsMessage')

    def parse(self, xml, provider=None):
        self.root = xml
        items = []
        try:
            for item_set in xml.findall(self.qname('itemSet')):
                for item_tree in item_set:
                    item = self.parse_item(item_tree)
                    try:
                        published = item_tree.xpath('.//xhtml:body/xhtml:header/'<commit_msg>fix(parsers):  Change the name of DPA NewsML parser<commit_after># -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013 - 2018 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

from superdesk.io.feed_parsers.newsml_2_0 import NewsMLTwoFeedParser
from superdesk.io.registry import register_feed_parser
from superdesk.errors import ParserError
from superdesk.metadata.item import CONTENT_TYPE
from superdesk import etree as sd_etree
from . import utils
import dateutil.parser
import logging

logger = logging.getLogger(__name__)
NS = {'xhtml': 'http://www.w3.org/1999/xhtml',
      'iptc': 'http://iptc.org/std/nar/2006-10-01/'}


class DPANewsMLFeedParser(NewsMLTwoFeedParser):
    """
    Feed Parser which can parse DPA variant of NewsML
    """

    NAME = 'dpanewsml'
    label = "NTB DPA NewsML"

    def can_parse(self, xml):
        return xml.tag.endswith('newsMessage')

    def parse(self, xml, provider=None):
        self.root = xml
        items = []
        try:
            for item_set in xml.findall(self.qname('itemSet')):
                for item_tree in item_set:
                    item = self.parse_item(item_tree)
                    try:
                        published = item_tree.xpath('.//xhtml:body/xhtml:header/'
{'fraction_non_alphanumeric': 0.10253699788583509, 'fraction_numerical': 0.016913319238900635, 'mean_word_length': 2.9212707182320443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7545006', 'n_tokens_mistral': 933, 'n_tokens_neox': 864, 'n_words': 239}