chromium/components/dom_distiller/core/page_features.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/dom_distiller/core/page_features.h"

#include <stddef.h>

#include <memory>
#include <string>
#include <string_view>

#include "base/json/json_reader.h"
#include "third_party/re2/src/re2/re2.h"
#include "url/gurl.h"

namespace dom_distiller {
/* This code needs to derive features in the same way and order in which they
 * are derived when training the model. Parts of that code are reproduced in the
 * comments below.
 */

namespace {

std::string GetLastSegment(const std::string& path) {}

int CountMatches(const std::string& s, const std::string& p) {}

int GetWordCount(const std::string& s) {}

bool Contains(const std::string& n, const std::string& h) {}

bool EndsWith(const std::string& t, const std::string& s) {}

}  // namespace

int kDerivedFeaturesCount =;

std::vector<double> CalculateDerivedFeatures(bool isOGArticle,
                                             const GURL& url,
                                             double numElements,
                                             double numAnchors,
                                             double numForms,
                                             const std::string& innerText,
                                             const std::string& textContent,
                                             const std::string& innerHTML) {}

std::vector<double> CalculateDerivedFeaturesFromJSON(
    const base::Value* stringified_json) {}

std::vector<double> CalculateDerivedFeatures(bool openGraph,
                                             const GURL& url,
                                             unsigned elementCount,
                                             unsigned anchorCount,
                                             unsigned formCount,
                                             double mozScore,
                                             double mozScoreAllSqrt,
                                             double mozScoreAllLinear) {}

}  // namespace dom_distiller