Documentation
¶
Overview ¶
Example ¶
c := paperswithcode_go.NewClient() papers, _ := c.PaperList(paperswithcode_go.PaperListParamsDefault()) fmt.Println(len(papers.Results)) gan, _ := c.PaperGet(paperswithcode_go.GetPaperIDFromPaperTitle("Generative Adversarial Networks")) fmt.Println(gan.Title)
Output: 50 Generative Adversarial Networks
Index ¶
- Constants
- func GetPaperIDFromPaperTitle(paperTitle string) string
- type Client
- func (c *Client) MethodGet(methodID string) (models.Method, error)
- func (c *Client) MethodList(params MethodListParams) (models.MethodList, error)
- func (c *Client) PaperGet(paperID string) (models.Paper, error)
- func (c *Client) PaperList(params PaperListParams) (models.PaperList, error)
- func (c *Client) PaperMethodList(paperID string) (models.MethodList, error)
- func (c *Client) PaperRepositoryList(paperID string) (models.RepositoryList, error)
- func (c *Client) PaperResultList(paperID string) (models.ResultList, error)
- func (c *Client) PaperTaskList(paperID string) (models.TaskList, error)
- type ClientOption
- type MethodListParams
- type PaperListParams
Examples ¶
Constants ¶
const (
BaseURL = "https://paperswithcode.com/api/v1"
)
Variables ¶
This section is empty.
Functions ¶
func GetPaperIDFromPaperTitle ¶
GetPaperIDFromPaperTitle generates a paper ID from paper title. WARNING: This function does not cover all cases.
Example ¶
paperTitle := "Generative Adversarial Networks" fmt.Println(GetPaperIDFromPaperTitle(paperTitle))
Output: generative-adversarial-networks
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) MethodGet ¶ added in v2.2.0
MethodGet returns a method in a paper. See https://paperswithcode-client.readthedocs.io/en/latest/api/client.html#paperswithcode.client.PapersWithCodeClient.method_list
func (*Client) MethodList ¶ added in v2.2.0
func (c *Client) MethodList(params MethodListParams) (models.MethodList, error)
MethodList fetches a list of "methods" that can be used in research papers.
func (*Client) PaperGet ¶
PaperGet returns a single paper. Note that paperID is hyphen cased (e.g., generative-adversarial-networks).
func (*Client) PaperList ¶
func (c *Client) PaperList(params PaperListParams) (models.PaperList, error)
PaperList returns multiple papers.
func (*Client) PaperMethodList ¶
func (c *Client) PaperMethodList(paperID string) (models.MethodList, error)
PaperMethodList returns the methods used in the given paper.
func (*Client) PaperRepositoryList ¶
func (c *Client) PaperRepositoryList(paperID string) (models.RepositoryList, error)
PaperRepositoryList returns repositories related to the given paper.
func (*Client) PaperResultList ¶
func (c *Client) PaperResultList(paperID string) (models.ResultList, error)
PaperResultList returns the evaluation results of the paper.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption can be used to swap the default http client or swap the API key
func WithAPIToken ¶
func WithAPIToken(apiToken string) ClientOption
WithAPIToken sets the client API token.
type MethodListParams ¶ added in v2.2.0
type MethodListParams struct { // Page (default: 1) Page int // ItemsPerPage (default: 50) ItemsPerPage int }
MethodListParams is an argument object to MethodList.
func (MethodListParams) Build ¶ added in v2.3.0
func (m MethodListParams) Build() string
Build used to expand `MethodListParams` to URL path params.
type PaperListParams ¶
type PaperListParams struct { // Q to search papers (default: "") // If empty, it returns all papers. Q string ArxivID string Title string Abstract string // Page is the number of page to search (default: 1) Page int // ItemsPerPage returns how many papers are returned in a single response. ItemsPerPage int }
PaperListParams is the parameter for PaperList method.
func PaperListParamsDefault ¶
func PaperListParamsDefault() PaperListParams
PaperListParamsDefault returns the default PaperListParams.
func (PaperListParams) Build ¶ added in v2.1.3
func (p PaperListParams) Build() string